Hi,

On Dec 7, 2007 4:56 PM, Chen <[EMAIL PROTECTED]> wrote:
> You can 'grep "^line$" "filename"' and check the variable "$?". If it
> is 0, there is the line. If 1, there isn't. The script maybe like,
>
> line1 = "any line"
> line2 = "another line"
>
> for i in *; do
>   grep "^$line1$" $i;
>   if [ x$? = x1 ]; then
>     echo $line1 >> $i;
>     grep "^$line2$" $i;
>     if [ x$? = x1]; then
>       echo $line2 >> $i;
>     fi
>   fi
> done

This will work.

Or:

if [ ! $(grep your_string win.ini) ]; then
  echo your_string >> win.ini
fi

Repeat for both strings.

Mike

_______________________________________________
Slugnet mailing list
[email protected]
http://www.lugs.org.sg/mailman/listinfo/slugnet

Reply via email to