x=`su - db2inst1 -c "db2 get dbm cfg" |grep KEYSTORE_LOCATION | awk '{print $5}'`
rc="$?"
echo "${rc}"
this echos a 0.
If I forcefully execute a wrong command
x=`su - db2inst1 -c "db get dbm cfg" |grep KEYSTORE_LOCATION | awk '{print $5}'`
rc="$?"
echo "${rc}"
this gives me an error:
-bash: db: command not found
but still gives a 0 return code. I think its for the assignment. But how do I evaluate for the command.