社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

修改变量时出现bash脚本错误的git别名

Joshua Soileau • 5 年前 • 1689 次点击  

我的Git分支名称:

feature/ACD-1706_new-api-call
如果我在控制台中运行此脚本,它将正常工作:
bash -l -c 'current_branch="$(git rev-parse --abbrev-ref HEAD)" && no_feature=${current_branch##*/} && no_underscore=${no_feature%%_*} && history -s "git commit -m \"$no_underscore | " && echo "Press UP to start commit command:" && echo "" && read -e -p "> " && eval "$REPLY"'
它会将我放入一个提示中,帮助我根据功能分支名称自动生成提交消息。
> bash -l -c 'current_branch="$(git rev-parse --abbrev-ref HEAD)" && no_feature=${current_branch##*/} && no_underscore=${no_feature%%_*} && history -s "git commit -m \"$no_underscore | " && echo "Press UP to start commit command:" && echo "" && read -e -p "> " && eval "$REPLY"'
Press UP to start commit command:

> 

但是如果我把它变成git别名,脚本就会出错。

auto-message = !bash -l -c 'current_branch="$(git rev-parse --abbrev-ref HEAD)" && no_feature=${current_branch##*/} && no_underscore=${no_feature%%_*} && history -s "git commit -m \"$no_underscore | " && echo "Press UP to start commit command:" && echo "" && read -e -p "> " && eval "$REPLY"'
> git auto-message
bash -l -c 'current_branch=$(git rev-parse --abbrev-ref HEAD) && no_feature=${current_branch: -c: line 0: unexpected EOF while looking for matching `''
bash -l -c 'current_branch=$(git rev-parse --abbrev-ref HEAD) && no_feature=${current_branch: -c: line 1: syntax error: unexpected end of file
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/40694
 
1689 次点击  
文章 [ 3 ]  |  最新文章 5 年前