Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は非常に新しく、変数に取り組んでいます。
ヘッド関数で変数を使用するにはどうすればよいのだろうか
例えば、
for ((i=0; i<5; i++)) head -((1+i)) test.txt
しかし、それはエラーを表示します。どうすればこれを修正できますか?
このようなものはどうですか:
for ((i=1; i<6; i++)) do head -n$i test.txt done
(like: )からエラーが発生しないように、変数iを at で開始したことに注意してください。また、ループ内で使用して変数にアクセスできます。1head head: illegal line count -- 0i$i
i
1
head
head: illegal line count -- 0
$i