-1

I have to set 10 env variables (setenv). I saved all these env variable in a filename.env. Is there a way to set all the variable inside the file with single command ?

I tried with "source filename.env", variables are getting set but many other things are also happening. Doubt what I did is wrong. Please help.

Edit: content of filename.env:

setenv variable1 value1
setenv variable2 value2
.
.
setenv variable10 value10
peterh
  • 9,731

1 Answers1

3

in bash:

With the following file ~/variables.rc:

export test1="test1"
export test2="test2"
export test3="test3"
export test4="test4"
export test5="test5"

You can source the file. Those sourced variables are then known in your terminal session:

[ws] user ~ >source variables.rc  
[ws] user ~ >echo $test3
test3

in csh:

With the following file ~/variables.rc:

setenv test1 test10
setenv test2 test20
setenv test3 test30
setenv test4 test40
setenv test5 test50

You can source the file. Those sourced variables are then known in your terminal session:

[ws] user ~ >source variables.rc  
[ws] user ~ >echo $test3
test30