首页 > bash中alias的命令有多层引号怎么处理

bash中alias的命令有多层引号怎么处理

比如这个命令,我在更新所有的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 命令稿, 再


我回答過的問題: Python-QA

【热门文章】
【热门文章】