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



On 04/07/2010 05:45 PM, Mart Frauenlob wrote:

#!/bin/sh
grep -w "fred" file || printf "%s\n" "fred">>file


Why not simply use
echo "fred" >> file
for the second command?


--
All men have the right to wait in line.

Eduardo M KALINOWSKI
eduardo@xxxxxxxxxxxxxxxxx


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/4BBCFF82.4070904@xxxxxxxxxxxxxxxxx



Relevant Pages