【Linux】^M: bad interpreter: No such file or directoryというError

事象 Windows機から転送したスクリプトをLinux機で実行した際に $ ./test.sh bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory とエラーとなる。 コマンド実行環境 Debian GNU/Linux 9 (stretch) 原因と対策 該当スクリプトは一行目に以下のように記載、末尾に改行が入っている。 #!/bin/bash⏎…