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

 爱rain宝520 发布于 2022-11-01 11:11

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

这样是不行的。应该怎么写呢?

1 个回答
  • 也許可以考慮不要寫那麼複雜的 alias, 把它存成一個 bash 命令稿, 再

    • alias 指向該命令稿

    • 將該命令稿放在 PATH 底下


    我回答過的問題: Python-QA

    2022-11-12 01:53 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有