私のOS:Fedoraリリース13(ゴダード)
「test」の下には5つのディレクトリがあります
[root@localhost lab]# ls test
dir1 dir2 dir3 dir4 dir5
スクリプト1
#!/bin/bash
#below line for listing all directories under '/home/arun/lab/test'
ls -Al --time-style=long-iso /home/arun/lab/test | grep '^d' | awk '{print $8}' | while read line
do
#Need to skip few directoirs
if [ "$line" == "dir1" -o "$line" == "dir2" ]; then
continue
fi
#will take some actions here..as of now just echo only
echo $line
done
Script2 [変更のみ == を != に変更]
#!/bin/bash
#below line for listing all directories under '/home/arun/lab/test'
ls -Al --time-style=long-iso /home/arun/lab/test | grep '^d' | awk '{print $8}' | while read line
do
#Need to skip few directoirs
if [ "$line" != "dir1" -o "$line" != "dir2" ]; then
continue
fi
#will take some actions here..as of now just echo only
echo $line
done
期待される o/p を与えるスクリプト 1
[root@localhost lab]# ./test.sh
dir3
dir4
dir5
問題は次のとおり です。スクリプト 2 については、o/p 以下を期待しています。しかし、実行中にo / p [空白]はありません..これで私を助けてください。
[root@localhost lab]# ./test.sh
dir1
dir2