1
0

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 1 year has passed since last update.

dos fileとunix fileのシバン報告

Last updated at Posted at 2024-07-18

スクリプトに実行権を付けて、実行させると、

bash: ./f.gm: 実行できません: 必要なファイルがありません

と出て、neovimで見ても一見分からず、しばらく悩んでいて、仕方なくバイナリファイルエディタbviで見たら、行末に^Mがあったので、やっとそのファイルがdosフォーマットだと分かり、フォーマット変換をしたら実行できた。
どうも、bashが、#!/usr/bin/nantoka^Mをそのまま解釈して、/usr/bin/nantoka^Mを呼び出していたので、そういうことになったらしい。
neovimで、コントロールコードを見れるフラグを立てたら良かった。
でも、ここは、

bash: ./f.gm: /usr/bin/nantoka^M: 実行できません: 必要なファイルがありません

と、出力するべきではないでしょうか。

以上、報告でした。

追記:
コントロールコードを見れるフラグはvi関係のエディタでは、listオプションですが、どういうわけか^Mは表示されませんでした。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?