I've to run a .csh
script from a bash
shell, to accomplish this I'm using tcsh -c <command>
command but with that I also require environment variables defined in parent bash
shell. Could someone suggest a way to export environment variables from bash
to tcsh
. I would like to have the below structure for my command.
$ tcsh -c "env ENV_VAR=${ENV_VAR} /command/to/run <args>"
Just add the variables to the environment of tcsh
; the script will inherit them from tcsh
. (I'm assuming /command/to/run
is a C-shell script.)
$ SOME_VAR="some value" tcsh -c "/command/to/run <args>"
Assuming the argument to -c
isn't some more complicated C-shell expression, you can dispense with the option.
$ SOME_VAR="some value" tcsh /command/to/run <args>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.