3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Linux】【Shell】command not foundshの解決メモ

Posted at

##シェル文法は問題ないはずのシェルスクリプト動かない
こんなエラーが出た
: command not foundsh

##原因
改行コードが変わっていた。
恐らくこんな流れかな?
Linuxでシェルを作る -> Windowsにwinscpを利用してシェルスクリプトを移動する -> 他のサーバにwinscpを利用してシェルスクリプトをコピーする
これで改行コードがLF -> CRLFになってしまいシェルスクリプトが動かなくなった

##対応
こんな感じで改行コードを変更し実行!!
nkf -Lu crlf.txt > lf.txt

##参考
http://bambi3.exblog.jp/6799282
http://ratememo.blog17.fc2.com/blog-entry-824.html

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?