[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Script to add line to file if it doesn't exist



On 2010-04-07 16:12, Ron Johnson wrote:
[snip]

Mart's method is the shell way.  The 3GL Way is:

grep -w "$NAME" "$FILE"
TMP=$?
if [ "$TMP" = "1" ];

That should be:

if [ "$TMP" = "0" ];

then
    echo -e "$NAME\n" >> "$FILE"
fi




--
"History does not long entrust the care of freedom to the weak
or the timid."  Dwight Eisenhower


Reply to: