If I understand you right, you want an exit code from your script. And then read that code.

That is done like this:

------------- /opt/myapp/bin/config -------------------
#!/bin/sh

# check stuff here...

# set env vars here...
export MYVAR="/path/to/executable"


if [ test ]; then exit 1 fi

if [ test2 ]; then
   exit 2
fi

exit 0

---------------------------

You should then be able to run in .bachrc

. /opt/myapp/bin/config

echo $?     ## to find out the exit code
echo $MYVAR    ## should return /path/to/executable


Am I misunderstanding the question?


Mark


Jay Strauss wrote:


Hi,

I want to get the path of the file from a script called from .bashrc. Like:

##.bashrc
. /opt/myapp/bin/config


## /opt/myapp/bin/config pwd echo $0


In this case during login: pwd = /home/jstrauss $0 = -bash

I'd like to get a variable with the value /opt/myapp/bin/config
but I can't find a combination of commands that will give my that during
login or su

Jay


_______________________________________________ vox-tech mailing list [EMAIL PROTECTED] http://lists.lugod.org/mailman/listinfo/vox-tech






_______________________________________________ vox-tech mailing list [EMAIL PROTECTED] http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to