Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.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
Unix .bash\u配置文件中意外标记“(';附近出现语法错误_Unix_.bash Profile - Fatal编程技术网

Unix .bash\u配置文件中意外标记“(';附近出现语法错误

Unix .bash\u配置文件中意外标记“(';附近出现语法错误,unix,.bash-profile,Unix,.bash Profile,尝试在我的中创建此函数时,我遇到语法错误。bash_profile: linkrepo () { ln -s "~/My/Path/$1"; } 我正在使用Sublime Text 3编辑此函数/配置文件 我也尝试过: linkrepo() { ln -s "~/My/Path/$1"; } linkrepo ( ) { ln -s "~/My/Path/$1"; } linkrepo () { ln -s ~/My/Path/$1; } linkrepo() { ln -s ~/My/Pat

尝试在我的
中创建此函数时,我遇到语法错误。bash_profile

linkrepo () { ln -s "~/My/Path/$1"; }
我正在使用Sublime Text 3编辑此函数/配置文件

我也尝试过:

linkrepo() { ln -s "~/My/Path/$1"; }
linkrepo ( ) { ln -s "~/My/Path/$1"; }
linkrepo () { ln -s ~/My/Path/$1; }
linkrepo() { ln -s ~/My/Path/"$1"}
还有这些的每一个变化。我总是得到这个错误:

syntax error near unexpected token `('

很明显,问题出在我使用的bash版本上。我是在3.2.57上。当我更新到4.3.42(1)版本时,我能够使用:

linkrepo () { ln -s "~/my/path/$1"; }

试着在块中用;,像这样结束命令:linkrepo(){ls-l”“;}@damjandimitriski我已经尝试用分号结束命令。我的例子中有4个有分号。我得到了bash 4.3.11(1),这个linkrepo(){ln-s“~/tmp/$1”“~/bla”}在我的shell中工作,shell都是用~/.bashrc profile测试和编写的。事实上,只有你的第4个示例不起作用。@Damjandimitriski我使用的是
。bash_profile
,这有什么区别吗?你是如何检查你的bash版本的?@stevek使用
bash-v
根据,
-v
标志表示详细,而不是版本。对于check version运行
bash--version