Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
#!/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
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.