Problem wit the $? variable

Hi Friends,

I have a problem when i run this piece of script, and do echo $? it always gives me value 0, even if the string "CCRCWebServerINSTALLDIR" is not present in that file. Why is that so, can you give me suggestion to the changes i need to make?

$find /home/administrator/testfix/install/cc.offering/com.ibm.rational.clearcase.iehs.assembly -exec  grep CCRCWebServerINSTALLDIR {} \;

Thanks
Adi

Hi.

Find doesn't return an error in that case.

Try

find /home/administrator/testfix/install/cc.offering/com.ibm.rational.clearcase.iehs.assembly | xargs grep CCRCWebServerINSTALLDIR
 
echo $?
1

Thanks Scottn

'$?' is among some of the special parameters that are designated by the shel for yielding information about the environment in general and the process being executed.

'$?' is the exit status of the last executed command , which is 0 for success and 1 for failure
list of other parameters are...
$$- PID of current shell
$!- PID of last background process
$- -current shell settings
$#- total no. of positional parameters
$0 - name of the command being executed
$* - list of all shell arguments. Cant yield each argument separately
$# - similar to $*, but yields each argument separately when enclosed with double quotes.