Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows bash脚本中的变量被视为命令-";“未找到命令”;_Windows_Bash - Fatal编程技术网

Windows bash脚本中的变量被视为命令-";“未找到命令”;

Windows bash脚本中的变量被视为命令-";“未找到命令”;,windows,bash,Windows,Bash,我正在使用git for windows,希望编写一个bash函数,将当前工作分支更新为master。以下是我写的: sync() { branch = $(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') git checkout master git pull origin/master git checkout $branch } 但是,当我调用此函数时,它会抛出一个错误:

我正在使用git for windows,希望编写一个bash函数,将当前工作分支更新为master。以下是我写的:

sync() { 
        branch = $(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
        git checkout master
        git pull origin/master
        git checkout $branch
}
但是,当我调用此函数时,它会抛出一个错误:

bash:branch:未找到命令


如何解决此问题?

删除
=
之间的空格,使其内容如下:

branch=$(git符号参考头| sed-e,.*/\(.*\),\1')