![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| have a problem with if elif loop .. plz help me with the script | Syms | UNIX for Dummies Questions & Answers | 4 | 11-01-2007 02:59 AM |
| IF THEN ELIF question in BOURNE SHELL | arun_st | UNIX for Dummies Questions & Answers | 4 | 04-20-2007 01:41 PM |
| If..elif..else...fi | Rock | Shell Programming and Scripting | 2 | 02-08-2007 06:32 AM |
| elif not expected | pv0428 | Shell Programming and Scripting | 9 | 07-28-2005 05:38 AM |
| if...elif...fi condition in Unix | abidmalik | UNIX for Dummies Questions & Answers | 9 | 09-05-2002 09:35 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help with ELIF statement
I am receiving an elif error on line 13 and I can not figure out the reasoning behind it. I have added the then statement that I was initially missing. Any help would be great.
#The purpose of this script is for the end user to be able to enter a positive number #User enters a number NUM=$1 #If user enters more than one it will return this statement if [ $# -ne1 1 ] then echo "Only enter one number!" exit #For if the user enters a negative number elif [ $NUM -le 0 ] then echo "Enter a positive number!" fi #Executionary if statement while [ "$NUM" -gt 0 ] do printf $NUM if[ $NUM -gt 1 ] then printf "," fi NUM=$((NUM - 1)) done Thanks |
|
||||
|
You are missing a semicolon before an earlier then. Also -ne is misspelled.
The syntax of the if statement is Code:
if some command or other; then action else otheraction fi |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|