0
if else
ループがwhile
の中にありますが、それは私に適切な出力が得られていません。私は取得していますループスクリプトがシェルスクリプトで動作していないときに勝つ
#!/bin/bash
set -x
inputFile=/data2/example/output1.txt
while read col1 col2 col3; do
if [ $col2=='Success' ]
then
echo " This is Green"
else
echo " This is Red"
fi
done < ${inputFile}
出力は次のようになります。ここでは
+ read col1 col2 col3
+ '[' Success==Success ']'
+ echo ' This is Green'
This is Green
+ read col1 col2 col3
+ '[' Success==Success ']'
+ echo ' This is Green'
This is Green
+ read col1 col2 col3
+ '[' Failed==Success ']'
+ echo ' This is Green'
それはelse
一部を入力し、継続的にThis is Green
を表示していません。
のこの
を使用しますか? – Danieboy