"-z" from grep is there for something :-) . Also, beware that "pidof kded4" sometimes returns two values, we can avoid that using "pgrep -u "$USER":



#!/bin/bash
if [[ -n $SSH_CLIENT ]]; then...