LoginSignup
12
10

More than 5 years have passed since last update.

環境変えたらシェルスクリプトがエラーになった

Last updated at Posted at 2016-11-15

状況

今まで使っていたシェルスクリプトを環境を変えて使おうと思ったらなんでも無さそうな所でエラー発生。

Syntax error: redirection unexpected

原因

エラーメッセージでぐぐったらどうやらbashじゃなくdashで動いていたせいらしい。
そのせいで、dashでは利用ができない<<< を利用している所でエラーが発生した模様。

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Nov 15 08:09 /bin/sh -> dash*

解決策

/bin/sh の紐付けをbash に切り替えてあげましょう。

$ sudo dpkg-reconfigure dash
# NOを選択する

dashの設定ウィザードをやり直し、デフォルトシェルにdashを使わなくする

Ref

12
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
10