[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

matching on $1 in bash



I have a short script that matches if statements based on the value of $1.
If the user does not enter a $1 value, I would like to script to echo a
help menu. I am trying to do this by a conclusive 'else' statement,
however when i do, I get:

./wos: [: =: unary operator expected

so, the script is:

if [ $1 = "-o" ]; then 
	<bash commands>
elif [ $1 = "-c" ]; then
	<bash commands>
else
   	echo "stuff"

Does $1 need to be defined as something in order for this final else to
act without complaining? How do you go about setting built in variables
like this?

thanks -cjm

-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.