Oracle DBA – A lifelong learning experience

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 Oracle_Home. As the command worked I didn’t think anymore of it until on the same server against an home I got the same error message.

opatch lsinventory
 tr: extra operand `y'
 Try `tr --help' for more information.
 /app/oracle/product/ 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

2 Responses to “opatch lsinventory gives “line 384: [: =: unary operator expected””

  1. The correct Doc Id is 1551584.1, you apparently lost the leading “1”.
    Oracle’s bugs are getting more and more strange and funny.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: