by shigemk2

当面は技術的なことしか書かない

今日のシェル芸

引数でファイルを指定して1行ずつ表示させる

1行ずつのファイル読み込み | hiro345

while read lineがキモ。

#!/bin/sh
filename=$1
cat ${filename} | while read line
do
  echo ${line}
done

構文テスト

sh -n

スクリプトの実行と環境