The idea is simple: ###
VARS=$( # this allows to capture subshell stdout to a variable . $HOME/script.sh 1>/dev/null # this prevents script printing something to stdout set # this prints all variables to stdout alias | sed 's/.*/alias \0/' # this prints aliases to stdout and prefixes them with "alias " ) || ERRCODE="$?" if [ $ERRCODE==0 ] then eval $VARS # if everything is ok, we reevaluate the variables and aliases in this shell fi ### Now the "VARS=$(command) || ERRCODE="$?"", || prevents the command from exiting the script if the next command exits with code 0. We could also use "VARS=$(command) || true", but then "$?" would contain the result of command "true", since ERRCODE="$?" also exits with code 0 we can prevent the shell from exiting and remember the correct error code. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error in ~/.profile halts the X startup To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs