Skip to main content
added 3 characters in body
Source Link

For my case I ended up doing something like:

code=$(grep -ci 'text' file.sh 2>&1 > /dev/null; echo $?) echo $?$code 0 

Works if you are only interested in the return code and you are willing to discard. stdout and stderr

For my case I ended up doing something like:

code=$(grep -ci 'text' file.sh 2>&1 > /dev/null; echo $?) echo $? 0 

Works if you are only interested in the return code and you are willing to discard. stdout and stderr

For my case I ended up doing something like:

code=$(grep -ci 'text' file.sh 2>&1 > /dev/null; echo $?) echo $code 0 

Works if you are only interested in the return code and you are willing to discard. stdout and stderr

Source Link

For my case I ended up doing something like:

code=$(grep -ci 'text' file.sh 2>&1 > /dev/null; echo $?) echo $? 0 

Works if you are only interested in the return code and you are willing to discard. stdout and stderr