shell script problem

Jack Mc Lauren jack.mclauren at yahoo.com
Sun Dec 23 09:05:37 UTC 2012


Hi all
Please take a look at the script below wich I've wrote :
1- cat /foo/bar.txt | while read $LINE12- do3-    cat /foo/bar/foo/bar.txt | while read $LINE24-    do 5-         if [ "$LINE1" = "$LINE2" ]; then6-               sw="1"7-               echo "Current value of sw is : " $sw8-               break9-         fi10-    done11-    echo "Value of sw is : " $sw12-    if [ "$sw" = "0" ]; then13-         DO SOMETHING14-    fi15-    sw="0"16- done          
You probebly guessed what I want to do. But the problem is that when the value of sw sets to 1 (in the first if statement) and the loop breaks , the value of sw is not '1' anymore in " echo "Value of sw is : " $sw " !!!
Thanks in advance ...


More information about the freebsd-questions mailing list