以下のコードline
は、コマンドの出力として返される文字列の行です。スクリプトを実行すると、文字列のすべてのトークンが表示されますが、ディレクトリのリストも追加されます。私は自分が間違っていることを本当に理解できません。
for word in $line
do
inner_count=$((inner_count + 1))
echo $word
done
コード全体は次のとおりです。
while read -r line
do
if [ "$count" = "2" ];
then
inner_count=0
#parse each line
#if [ "$debug" = "1" ] ; then printf "%s\n" "$line" > /dev/kmsg ; fi
for word in $line
do
if [ "$inner_count" = "0" ]; then tmp1="$word" ; fi
if [ "$inner_count" = "4" ]; then temp2="$word" ;fi
inner_count=$((inner_count + 1))
done
fi
count=$((count + 1))
done < <(batctl tg)