Right forgot about the variables.

After poking around in dash source I found that "$HOME/.profile" has
been hardcoded. So the change needs be made in the shell to make
".profile" safe.

Also I found a way to keep the variables from subshell

### test.sh ###
ERRCODE=0
TEST=""
VARS=$(set -e; . $HOME/script.sh 1>/dev/null; set) || ERRCODE="$?"
if [ $ERRCODE==0 ]
then
    eval $VARS
fi
echo "ERRCODE =" $ERRCODE
echo "   TEST =" $TEST
### script.sh ###
TEST="something"
function AddPath { echo "err" }
######

This also has one nice thing that when the script fails the environment
stays unchanged. Also there may be some variables that shouldn't be
taken from the subshell, but I have no idea which.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to 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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to