15
9

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.

shell : catコマンド 最後に改行を入れて表示

Last updated at Posted at 2014-04-01

catコマンドで最後の改行が無くなるのがいやなので、こういう関数を定義する。

catln() { echo "$(cat $@)"; }

引数にファイル名を与えると最後の改行も表示される。

catln hoge.txt
AAA
BBB
CCC

catと同じオプションが使えます。全部確認してません。

catln -n hoge.txt
   1 AAA
   2 BBB
   3 CCC
15
9
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
15
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?