[sf-lug] 'source' works but 'shebang' doesn't

Alex Kleider akleider at sonic.net
Fri Aug 26 09:36:07 PDT 2016


Mystery:

alex at X301n3:~/Py/Backup/Backup$ cat ./path.sh
#!/bin/bash
# Add current working directory to the PYTHONPATH.
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(pwd)"

alex at X301n3:~/Py/Backup/Backup$ echo $PYTHONPATH

alex at X301n3:~/Py/Backup/Backup$ ./path.sh
alex at X301n3:~/Py/Backup/Backup$ echo $PYTHONPATH

alex at X301n3:~/Py/Backup/Backup$ source ./path.sh
alex at X301n3:~/Py/Backup/Backup$ echo $PYTHONPATH
/home/alex/Py/Backup/Backup
alex at X301n3:~/Py/Backup/Backup$ ls -l path.sh
-rwxr-xr-x 1 alex alex 118 Aug 26 09:24 path.sh

I don't understand how
source ./path.sh
does the job but
./path.sh
does not!

Can anyone explain?

a




More information about the sf-lug mailing list