In my script I am trying to error check if the first and only argument is equal to -v but it is an optional argument. I use an if statement but I keep getting the unary oper
Quotes!
if [ "$1" != -v ]; then
Otherwise, when $1 is completely empty, your test becomes:
$1
[ != -v ]
instead of
[ "" != -v ]
...and != is not a unary operator (that is, one capable of taking only a single argument).
!=