-   Programming (
-   -   command grep (

podariu 02-11-2010 06:45 AM

command grep
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 06:53 AM

Hi and welcome to LinuxQuestions!

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

backtolinux 02-11-2010 07: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 07:15 AM

it works
thanks guys

All times are GMT -5. The time now is 08:15 AM.