The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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
ls positional parameter vasuarjula AIX 1 02-13-2008 06:49 PM
positional grep Manish Jha Shell Programming and Scripting 1 05-16-2006 11:33 AM
Positional Parameters ericelysia UNIX for Dummies Questions & Answers 15 10-23-2005 12:11 PM
Positional Parameters google Shell Programming and Scripting 2 09-26-2003 10:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-2007
Registered User
 

Join Date: Nov 2007
Posts: 1
Stumble this Post!
Unhappy Positional parameters

I need to get file names from commandline arguments, it may be any no of arguements, Using for loop i got but how do i display it, bcoz $i will give the number i is assigned $$i is not working either $($i), i need the names of the files got in the arguement
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-22-2007
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
Stumble this Post!
try this

Code:
#!/bin/ksh
while (($1))
do
echo $1
shift
done
For your 'for' loop issue try
Code:
eval echo \$$i
Reply With Quote
  #3 (permalink)  
Old 11-22-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Stumble this Post!
or alternatively

Code:
#!/bin/sh

for d in $@
do
    echo $d
done
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0