![](/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.