我在Ubuntu的服务器实例的.bash_profile对谷歌的云为拉有这些功能,推动混帐分支猛砸功能
plb(){
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $branch
}
psb(){
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git push origin $branch
}
如果我单独运行的代码行,则正常工作,但是当我尽量把它放在一个功能,它显示了以下错误
$ plb
: command not found
: command not found
我在做什么错在这里,谢谢大家提前
输出命令: -
[email protected]:~$ proj
[email protected]:/var/www/staging/Server/www$ branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
[email protected]:/var/www/staging/Server/www$ echo $branch
staging
[email protected]:/var/www/staging/Server/www$ plb
: command not found
: command not found
[email protected]:/var/www/staging/Server/www$
您需要导出您的功能。尝试在你的.bash_profile中添加'export -f plb'和'export -f psb' – Aserre
@Aserre添加了导出,但它仍然无法工作,现在我的.bash_profile看起来像这样 plb(){ branch = $( git branch | sed -n -e's/^ \ * \(。* \)/ \ 1/p') git pull origin $ branch } psb(){branch = $(git branch | sed - 您可以使用git push origin $ branch } export -f plb export -f psb – rohan