2012/12/23 Polytropon <[email protected]>
>
> #!/bin/sh
>
> cat foo.txt | while read LINE1
> do
> cat bar.txt | while read LINE2
> do
> if [ "$LINE1" = "$LINE2" ]; then
> sw="1"
> echo "Current value of sw is : " $sw
>
* ps -l | grep $$ *
# see subshell here
> break
> fi
> done
>
* echo " Process: " $$*
# And the parent
> echo "Value of sw is : " $sw
> if [ "$sw" = "0" ]; then
> echo "DO SOMETHING!"
> fi
> sw="0"
> done
>
I suggest :
-----------------%><-------------------------------------
#!/bin/sh
cat foo.txt | while read LINE1
do
echo 'One' > $$tmp
cat bar.txt |while read LINE2
do
if [ "$LINE1" = "$LINE2" ]; then
echo 'ok' > $$tmp
break
fi
done
if [ `cat $$tmp` = "One" ]; then
echo "One !"
fi
if [ `cat $$tmp` = "ok" ]; then
echo "ok !"
fi
done
Best regards
---------------------------------------------------------
(°> Dhénin Jean-Jacques
/ ) 48, rue de la Justice 78300 Poissy
^^ [email protected]
---------------------------------------------------------
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"