linux - bash中alias的命令有多层引号怎么处理
黄舟
黄舟 2017-04-17 15:25:11
[Linux讨论组]

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号