击:语法错误:意外重定向 [英] Bash: Syntax error: redirection unexpected
本文介绍了击:语法错误:意外重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我这样做是在脚本:
read direc <<< $(basename `pwd`)
和我得到的:
Syntax error: redirection unexpected
在一个Ubuntu机
/bin/bash --version
GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu)
虽然我不另一个SUSE机得到这个错误:
while I do not get this error in another suse machine:
/bin/bash --version
GNU bash, version 3.2.39(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
为什么出错?
推荐答案
请问你的脚本参考 /斌/庆典
或 / bin / sh的
在其散列砰行?在Ubuntu系统默认的shell是破折号,不是的庆典,所以如果你有#!/ bin / sh的
则脚本将使用不同的外壳比你预期。短跑不具备&LT;&LT;&LT;
重定向操作符
Does your script reference /bin/bash
or /bin/sh
in its hash bang line? The default system shell in Ubuntu is dash, not bash, so if you have #!/bin/sh
then your script will be using a different shell than you expect. Dash does not have the <<<
redirection operator.
这篇关于击:语法错误:意外重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文