Export commands works in interactive mode, but produces error message in script [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
How can I make environment variables “exported” in a shell script stick around?
2 answers
What's the difference between “export” and “setenv”?
1 answer
I need to export an environmental variable to run a program. I am able to successfully do that in interactive mode. However, when I try to export an environmental variable as part of a bash shell script, I get this error message:
export: Command not found.
In interactive mode, when I type in the following command, it works.
export GT_DIR=/cluster/home/SD/
But when I include the export command as part of the shell script, it does not work. I.e.,
#!/bin/bash
export GT_DIR=/cluster/home/SD/
I get the error message:
export: Command not found.
When I type in echo $SHELL
, I get
/bin/bash
Why is the export command working in interactive mode but not when I try to submit it as a script?
bash shell-script qsub
marked as duplicate by Fabby, G-Man, RalfFriedl, Filipe Brandenburger, Isaac Nov 24 at 22:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
show 6 more comments
up vote
0
down vote
favorite
This question already has an answer here:
How can I make environment variables “exported” in a shell script stick around?
2 answers
What's the difference between “export” and “setenv”?
1 answer
I need to export an environmental variable to run a program. I am able to successfully do that in interactive mode. However, when I try to export an environmental variable as part of a bash shell script, I get this error message:
export: Command not found.
In interactive mode, when I type in the following command, it works.
export GT_DIR=/cluster/home/SD/
But when I include the export command as part of the shell script, it does not work. I.e.,
#!/bin/bash
export GT_DIR=/cluster/home/SD/
I get the error message:
export: Command not found.
When I type in echo $SHELL
, I get
/bin/bash
Why is the export command working in interactive mode but not when I try to submit it as a script?
bash shell-script qsub
marked as duplicate by Fabby, G-Man, RalfFriedl, Filipe Brandenburger, Isaac Nov 24 at 22:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
you need tosource somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.
– thrig
Nov 23 at 21:46
4
How do you run your script?
– Cyrus
Nov 23 at 21:50
1
export: Command not found.
is exactly the error message that acsh
outputs.
– Cyrus
Nov 23 at 21:52
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26
|
show 6 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
How can I make environment variables “exported” in a shell script stick around?
2 answers
What's the difference between “export” and “setenv”?
1 answer
I need to export an environmental variable to run a program. I am able to successfully do that in interactive mode. However, when I try to export an environmental variable as part of a bash shell script, I get this error message:
export: Command not found.
In interactive mode, when I type in the following command, it works.
export GT_DIR=/cluster/home/SD/
But when I include the export command as part of the shell script, it does not work. I.e.,
#!/bin/bash
export GT_DIR=/cluster/home/SD/
I get the error message:
export: Command not found.
When I type in echo $SHELL
, I get
/bin/bash
Why is the export command working in interactive mode but not when I try to submit it as a script?
bash shell-script qsub
This question already has an answer here:
How can I make environment variables “exported” in a shell script stick around?
2 answers
What's the difference between “export” and “setenv”?
1 answer
I need to export an environmental variable to run a program. I am able to successfully do that in interactive mode. However, when I try to export an environmental variable as part of a bash shell script, I get this error message:
export: Command not found.
In interactive mode, when I type in the following command, it works.
export GT_DIR=/cluster/home/SD/
But when I include the export command as part of the shell script, it does not work. I.e.,
#!/bin/bash
export GT_DIR=/cluster/home/SD/
I get the error message:
export: Command not found.
When I type in echo $SHELL
, I get
/bin/bash
Why is the export command working in interactive mode but not when I try to submit it as a script?
This question already has an answer here:
How can I make environment variables “exported” in a shell script stick around?
2 answers
What's the difference between “export” and “setenv”?
1 answer
bash shell-script qsub
bash shell-script qsub
edited Nov 24 at 18:20
Rui F Ribeiro
38.3k1476127
38.3k1476127
asked Nov 23 at 21:40
SD23Nov18
11
11
marked as duplicate by Fabby, G-Man, RalfFriedl, Filipe Brandenburger, Isaac Nov 24 at 22:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Fabby, G-Man, RalfFriedl, Filipe Brandenburger, Isaac Nov 24 at 22:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
you need tosource somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.
– thrig
Nov 23 at 21:46
4
How do you run your script?
– Cyrus
Nov 23 at 21:50
1
export: Command not found.
is exactly the error message that acsh
outputs.
– Cyrus
Nov 23 at 21:52
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26
|
show 6 more comments
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
you need tosource somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.
– thrig
Nov 23 at 21:46
4
How do you run your script?
– Cyrus
Nov 23 at 21:50
1
export: Command not found.
is exactly the error message that acsh
outputs.
– Cyrus
Nov 23 at 21:52
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
you need to
source somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.– thrig
Nov 23 at 21:46
you need to
source somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.– thrig
Nov 23 at 21:46
4
4
How do you run your script?
– Cyrus
Nov 23 at 21:50
How do you run your script?
– Cyrus
Nov 23 at 21:50
1
1
export: Command not found.
is exactly the error message that a csh
outputs.– Cyrus
Nov 23 at 21:52
export: Command not found.
is exactly the error message that a csh
outputs.– Cyrus
Nov 23 at 21:52
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26
|
show 6 more comments
1 Answer
1
active
oldest
votes
up vote
-2
down vote
It worked once I added -S /bin/bash
to the shell script rather than as qsub -S /bin/bash
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-2
down vote
It worked once I added -S /bin/bash
to the shell script rather than as qsub -S /bin/bash
add a comment |
up vote
-2
down vote
It worked once I added -S /bin/bash
to the shell script rather than as qsub -S /bin/bash
add a comment |
up vote
-2
down vote
up vote
-2
down vote
It worked once I added -S /bin/bash
to the shell script rather than as qsub -S /bin/bash
It worked once I added -S /bin/bash
to the shell script rather than as qsub -S /bin/bash
edited Nov 23 at 23:56
Jeff Schaller
37k1052121
37k1052121
answered Nov 23 at 23:13
SD23Nov18
11
11
add a comment |
add a comment |
what do you get if you do 'type export' in shell, export is a builtin command in bash
– rAlen
Nov 23 at 21:45
you need to
source somethingthatexportsvariables
so the command is run within the current process. running a different script will only change the environment in that script, which then exits.– thrig
Nov 23 at 21:46
4
How do you run your script?
– Cyrus
Nov 23 at 21:50
1
export: Command not found.
is exactly the error message that acsh
outputs.– Cyrus
Nov 23 at 21:52
@rAlen when I do type export, I get this: export is a shell builtin
– SD23Nov18
Nov 23 at 22:26