LoginSignup
12
14

More than 5 years have passed since last update.

シェルスクリプトのfor文

Posted at

varがループ変数
inの後ろに${配列[@]}とするとdo~doneの中でvarを呼び出すとループ内の一時変数の値が参照できる。

#!/bin/bash

array=("oda" "toyotomi" "tokugawa")

for var in ${array[@]}
do
  echo $var
done
12
14
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
12
14