I want to append file with a string but before doing that i want to check if this string already exist in that file.I tried with grep on Solaris 10 but unsuccessful.Man pages from grep seems to suggest if the string is found command status will be 0 and if not 1.But i am not finding it.May be i am doing something wrong here?
I am looking for exist status 1 so that i can use it in if condition
[test system] /var/opt/oracle/test>cat test
london
america
australia
[test system] /var/opt/oracle/test>grep london test
london
[test system] /var/opt/oracle/test>grep london test|echo $?
0
[test system] /var/opt/oracle/test>grep england test|echo $?
0
[test system] /var/opt/oracle/test>