[Clug-tech] Bash Scripting
Shawn
sgrover at open2space.com
Tue Nov 21 01:37:13 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all.
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
multiple entries...)
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:
targettext="some value"
if ($targettext not in $MYFILE)
echo $targettext >> $MYFILE
How would I do this in bash?
Thanks for any tips.
Shawn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFYsjJ2B6Swl9qN24RAi2GAJ9VLTAR67UPFuyA9g30wSfRyK5iEwCgkvHm
qsvFOiJ9m3JLcPYmZ3ultP4=
=UdVQ
-----END PGP SIGNATURE-----
More information about the clug-tech
mailing list