[linux] bash vs command line
pediddle at u.washington.edu
Fri Sep 5 10:58:46 PDT 2003
On Friday, September 5, 2003, at 05:21 AM, Günther Mittermayer wrote:
> I need to create a couple of enviroment variables everytime I need to
> run some application.
> Instead of just typing the "exports" in the command line, I tryied
> creating a bash file to help me, but what seemed so simple is driving
> me crazy.
> echo $VAR
> export VAR
If you want to do that, you'll have to _source_ the script. Like
Russel said, a subshell (your script runs as a separate and new
instance of Bash) can't affect the parent shell. Sourcing the script
looks like this:
$> source your-script.sh
$> . your-script.sh
But if you do that, make sure it doesn't have any "exit" calls or
anything, because sourcing it will be exactly like typing each of the
commands yourself on the commandline.
Hope that helps,
Peter Davis <pediddle at u.washington.edu>
Furthermore, I believe bacon prevents hair loss!
More information about the Linux