using bash ( disown and &>/dev/null )
you need to run the application in bg ( gkrellm & ) and then disown it
if ps -C gkrellm -o user | grep "$LOGNAME" &>/dev/null then echo "gkrellm is already running" else gkrellm & disown fi
if you want to be more portable and use posix sh
you will need to use nohup (part of coreutils and POSIX)
as well as background ( nohup cmd & )
you would also use .profile instead of .bashrc
if ps -C gkrellm -o user | grep "$LOGNAME" 2>/dev/null 1>&2 then echo "gkrellm is already running" else nohup gkrellm & fi
other approaches will include, as @Pontus replied, using tools like dtach , screen or tmux , where the command is executed in a disconnected environment.
by Pontus:
it would be wiser to use the autorun functions of the window manager.
really :), since afaik gkrellm is a graphical application, it is better to autostart it using .xinitrc (if your registration manager supports it) or your autostart window manager.
source share