Burkhard Schultheis
2018-07-19 14:07:27 UTC
We have the following statement in a bash script running on AIX 7.2:
[ -n "$(grep \"^$2=\" \"$1\" 2>/dev/null)" ]
During run, $2 gets the value nagios_retcode= and $1 gets
/var/lib/ibm72dev_backup_state.txt.
This statement does not work because the resulting line looks like
grep '"^nagios_retcode="' '"/var/lib/ibm72dev_backup_state.txt"'
On Linux it does work, but not on AIX. Where does the extra apostrophes
come from? And how to avoid it?
Thanks in advance for your help!
Regards
Burkhard
[ -n "$(grep \"^$2=\" \"$1\" 2>/dev/null)" ]
During run, $2 gets the value nagios_retcode= and $1 gets
/var/lib/ibm72dev_backup_state.txt.
This statement does not work because the resulting line looks like
grep '"^nagios_retcode="' '"/var/lib/ibm72dev_backup_state.txt"'
On Linux it does work, but not on AIX. Where does the extra apostrophes
come from? And how to avoid it?
Thanks in advance for your help!
Regards
Burkhard