LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   command grep (http://www.linuxquestions.org/questions/programming-9/command-grep-788434/)

podariu 02-11-2010 07:45 AM

command grep
 
hi
im a beginner with linux and i want to know if there is a a way like the following command returns 0 for true , 1 for false and 2 for an error and not returning what is usually returnd the grep command

grep bla out.txt

colucix 02-11-2010 07:53 AM

Hi and welcome to LinuxQuestions!

Check the man page of grep and look for the -q (quiet) option.

backtolinux 02-11-2010 08:00 AM

in unix, 0 said succesfull execution, others than 0 said failed execution.

After issuing your command, get the values by "echo $?", the value returned by the last command.

podariu 02-11-2010 08:15 AM

it works
thanks guys


All times are GMT -5. The time now is 02:46 AM.