-3

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

closed as unclear what you're asking by Jeff Schaller, jimmij, Fox, mdpc, Rui F Ribeiro Jan 16 '18 at 1:00

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    What’s in the file and what, exactly, are the “many other things?” – Jeff Schaller Jan 15 '18 at 13:22
  • 4
    Why not add the content of your .env file to your question? – Weijun Zhou Jan 15 '18 at 13:26
  • 3
    What shell are you using? csh? – ilkkachu Jan 15 '18 at 13:32
  • using cshc @ilkkachu – tollin jose Jan 16 '18 at 12:07
2

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.