![](/img/trans.png)
[英]What's the difference between running python script in interactive shell and in Terminal of Linux(ubuntu 13)?
[英]What is the difference of running commands in terminal and shell script?
在终端中运行命令时,我想检查tmux别名是否存在:
$ type -t tmux
结果是
$ alias
但是,当我将“ type -t tmux”放入外壳脚本并运行时,结果是
$ ./test.sh
$ file
为什么结果不同?
我的test.sh是:
#!/usr/bin/env bash
set -e
type -t tmux
tmux应该读取并尊重.bash_profile
定义的任何别名,但.bashrc
中不读取任何别名。
调用test.sh是一个子过程,除非您从source test.sh
环境,否则不会使用当前过程中的环境,但这也允许该脚本修改当前环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.