Problem

/bash/sh gives you an “unary operator expected” warning message.

Analysis

This usually happens when you have in your script a comparision inside condition without using quotes such as:

if [ ${2} = "yes" ]; then
...

Solution

Placing quotes around ${2} things removes the “unary operator expected” message. You then will get this:

if [ "${2}" = "yes" ]; then
...
Shell script gives you an “unary operator expected” message

Leave a Reply

Your email address will not be published. Required fields are marked *