比如这个命令,我在更新所有的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"
这样是不行的。应该怎么写呢?
也許可以考慮不要寫那麼複雜的
alias
, 把它存成一個 bash 命令稿, 再用
alias
指向該命令稿或
將該命令稿放在
PATH
底下我回答過的問題: Python-QA