[Clug-tech] Bash Scripting
sgrover at open2space.com
Tue Nov 21 01:37:13 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
I'm writing a bash script to automate some tasks. One of the tasks is
to add a block of text to a file. The catch is that I only want this
block of text added if it is not already there (otherwise there'd be
I know I can use grep to find the text in question, but I'm not sure how
to use this in a bash script to equate to "this text exists".
So, in pseudo code, I'm after this:
if ($targettext not in $MYFILE)
echo $targettext >> $MYFILE
How would I do this in bash?
Thanks for any tips.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the clug-tech