What does "unary operator expected" mean

From Linuxintro
Revision as of 14:22, 20 December 2011 by imported>ThorstenStaerk (Created page with "When you work with Linux scripts on the command line, you will sometimes get an error message saying unary operator expected And you may wonder what this means. To give you an e...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When you work with Linux scripts on the command line, you will sometimes get an error message saying

unary operator expected

And you may wonder what this means. To give you an example, let's write a short bash script. Just copy and paste the lines below into a Linux Shell:

cat >test.sh<<EOF
echo "how is your name? "
read name
if [ $name = "thorsten" ]; then echo "I know you"; fi
EOF
chmod 777 test.sh

After you did this, you have a script test.sh