繁体   English   中英

如何将环境变量从bash导出到tcsh

[英]How to export environment variables from bash to tcsh

我必须从bash shell运行.csh脚本,以实现此目的,我使用了tcsh -c <command>命令,但.csh ,我还需要在父bash shell中定义环境变量。 有人可以建议一种将环境变量从bash导出到tcsh 我希望命令具有以下结构。

$ tcsh -c "env ENV_VAR=${ENV_VAR} /command/to/run <args>"

只需将变量添加到tcsh的环境中即可; 该脚本将从tcsh继承它们。 (我假设/command/to/run是一个C-shell脚本。)

$ SOME_VAR="some value" tcsh -c "/command/to/run <args>"

假设-c的参数不是更复杂的C-shell表达式,则可以省去该选项。

$ SOME_VAR="some value" tcsh /command/to/run <args>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM