[linux] bash vs command line

Cliff cliffo at u.washington.edu
Fri Sep 5 11:29:07 PDT 2003


Also, you can add the commands to your ~/.bash_profile in your home
directory. Every time you login, that file is sourced for you.

Cliff

Peter Davis wrote:


> 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.

>>

>> #!/usr/bash

>> VAR="50"

>> 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

> or

> $> . 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,





More information about the Linux mailing list