Bash: Syntax error: redirection unexpected

后端 未结 9 1712
终归单人心
终归单人心 2020-11-27 12:30

I do this in a script:

read direc <<< $(basename `pwd`)

and I get:

Syntax error: redirection unexpected

9条回答
  •  佛祖请我去吃肉
    2020-11-27 12:58

    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.

提交回复
热议问题