Reputation: 6891
I'm missing something very elementary. Under Mac OS X. I've tried chmod 0777 setdir.bsh. Must be something wrong with my settings.
#!/bin/bash
export proj=/Users/RParadox/projects/testproject/
echo $proj
Result:
$ bash setdir.bsh
/Users/RParadox/projects/testproject/
echo $proj
nothing??
Upvotes: 0
Views: 1059
Reputation: 272417
export
makes the variable available to subprocesses, not parent processes.
Can you source this file instead ? e.g.
$ . setdir.bsh
That will execute the file in the current process i.e. the shell itself.
Upvotes: 2