#! /bin/bash
# gitfetchssh ://Baidu.net @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14 git cherry-pick fee
# gitfetchssh ://Jenkins @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14
#git cherry-pick FETCH_HEAD -n
#1.替换Baidu.net
#2.删除后面的字符串
#过渡字符kwdsc
cherry pick=' gitfetchssh ://Baidu.net @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14 gitchhh
echo ' org instr : [ $ { cherry pick } ]
echo 'Substr: ${substr} '
rep=$ (echo $ substr|sed ' s/ssh : (/(/. * @ Gerrit/ssh : (/(/Jenkins @ Gerrit/' ) ) )。
echo 'Replace Str: ${rep} '
echo 'CherryPick Start
echo 'Will exec : [${rep}] '
echo 'CherryPick Start
#一句
command=$ (echo $ { cherry pick % * }|sed ' s/ssh : (/(/. * @ Gerrit/ssh 3360 )/(/Jenkins @ Gerrit/'
echo ' cherry拾取开始命令
echo 'Will exec : [${command}]
echo ' cherry拾取开始命令
shell脚本的sed是----替换、变量、转义字符https://blog.csdn.net/wangcg 123/article/details/50667883? utm_source=blogxgwz0