The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reverse an integer ali560045 Shell Programming and Scripting 4 05-20-2008 03:15 AM
jar command not being recognized orahi001 UNIX for Dummies Questions & Answers 1 05-06-2008 10:29 AM
awk field not recognized in backquotes voa2mp3 UNIX for Dummies Questions & Answers 4 10-07-2007 05:40 PM
Illegal User Id and User name is not recognized mykvalentin AIX 1 08-23-2006 02:59 AM
I am not being recognized Help Forum Support Area for Unregistered Users & Account Problems 0 01-10-2006 04:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-14-2004
scmay scmay is offline
Registered User
  
 

Join Date: Apr 2004
Location: Melbourne
Posts: 15
Argument not recognized as integer

I need to accept a number of arguments at command line and print it in reverse order

i use eval `echo x=$1` to capture the argument

#! /bin/sh
counter=0
while [ $# -ne 0 ]
do
eval `echo x=$1`
arg$counter=$x
counter=`expr $counter + 1`
shift
done

but the error keeps telling me counter cannot increment, saying it is not numeric....?????
  #2 (permalink)  
Old 05-14-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
I don't see a problem with counter and I do not get that error message. But there are other problems.

eval `echo x=$1`
is silly. Why not just
x=$1

arg$counter=$x
is just wrong. You need
eval arg$counter=$x

Or to put the two lines together...
eval arg$counter=$1
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0