# here I put the commands to run, so I can decide to call them later run_commands() { xmodmap ~/.Xmodmap fbsetbg -l mrxvt & } # I feel like this 'exec' command is totally inappropriate, but the 'wait' # command doesn't work without it exec /usr/local/bin/fluxbox -log ~/.fluxbox/log & fbpid=$! # wait for 1 second, to make sure things start after fluxbox sleep 1 case "x$1" in x) run_commands;; esac # if fluxbox crashes, that's ok -- we'll restart another one # if this loops, I can always use control-alt-backspace wait $fbpid || exec $0 norun