Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
#!/bin/bash

#

#

#

#

echo -e "please insert user name :"

read un

echo "$un"

len=${#un}

echo "$len"

ze=0

te=10

if [ "$len" -eq "$ze" ]

than

echo "no argument"

exit

fi

if [ "$len" -ge "$te" ]

than

echo "the Argument maximum 10 alphanumeric"

exit

fi
share|improve this question

1 Answer 1

up vote 5 down vote accepted

In short: spelling error: it's then, not than.

Longer story: the syntax of the if command is this (boldface characters mark words that cannot be omitted or replaced):

if test-commands; then commands; fi

where you can replace the ; token with a new line character.

The shell will interpret than as part of test-commands, but then it finds a fi statement, which is incorrect (and, yes, unexpected) because it never encountered the then part.

share|improve this answer
    
thank you Mr.Riccardo –  Beginners Oct 30 '11 at 13:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.