比如这个命令,我在更新所有的git branch。
git branch | awk 'BEGIN{print "echo ****Update all local branch...@daimon***"}{if($1=="*"){current=substr($0,3)};print a"git checkout "substr($0,3);print "git pull --all";}END{print "git checkout " current}' |sh
现在我要把这个命令alias到gitpullall下
alias gitpullall="git branch | awk 'BEGIN{print "echo ****Update all local branch...@daimon***"}{if($1=="*"){current=substr($0,3)};print a"git checkout "substr($0,3);print "git pull --all";}END{print "git checkout " current}' |sh"
这样是不行的。应该怎么写呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
也許可以考慮不要寫那麼複雜的
alias, 把它存成一個 bash 命令稿, 再用
alias指向該命令稿或
將該命令稿放在
PATH底下我回答過的問題: Python-QA