opatch lsinventory gives “line 384: [: =: unary operator expected”
Posted by John Hallas on February 19, 2015
I noticed the error message when running lsinventory against a 18.104.22.168 Oracle_Home. As the command worked I didn’t think anymore of it until on the same server against an 22.214.171.124 home I got the same error message.
opatch lsinventory tr: extra operand `y' Try `tr --help' for more information. /app/oracle/product/126.96.36.199/dbhome_1/OPatch/opatch: line 384: [: =: unary operator expected
There is a Mos note which provides a solution – 1551584.1
Modify following line (line number 384) in file $ORACLE_HOME/OPatch/opatch
if [ `echo $arg | tr [A-Z] [a-z]` = "-invptrloc" ]; then
if [ `echo $arg | tr A-Z a-z` = "-invptrloc" ]; then
However the real problem is caused by the presence of a file with a single character name in the current directory. Indeed there was such a file ‘x’ and once that was removed then the opatch lsinventory command worked as normal.
This bug appears when a new version of opatch is installed , in my case I had just added opatch version 188.8.131.52