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
TextCite: Publication Quotation Manager 1.3 (Default branch) iBot Software Releases - RSS News 0 05-08-2008 03:10 PM
TextCite: Publication Quotation Manager 1.0.3 (Default branch) iBot Software Releases - RSS News 0 01-26-2008 07:20 PM
enclose a line with quotation marks gfhgfnhhn Shell Programming and Scripting 3 03-05-2007 02:28 AM
Tricky script question budrito Shell Programming and Scripting 3 06-30-2006 12:06 AM
Tricky File Permission Question Hook Filesystems, Disks and Memory 3 07-16-2002 12:25 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-04-2008
Registered User
 

Join Date: Aug 2008
Posts: 64
Tricky Quotation Question

Hi,

I am at a point in my script where I defined the number of the command line parameter I would like to set a variable equal to:

parameter_number=14

I would then like to set a variable equal to the correct parameter:

variable=$parameter_number

The issue here is that {} is required (ie. variable=${parameter_number}). What should I do so that the shell will expand the statement and set "variable" equal to my 14th command line parameter?
Reply With Quote
Forum Sponsor
  #2  
Old 09-04-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Code:
eval variable=\${$parameter_number}
Reply With Quote
  #3  
Old 09-04-2008
Registered User
 

Join Date: Aug 2008
Posts: 64
Hi,

Thank you that works beautifully.

Mike
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
eval, variable

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:59 PM.


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

Content Relevant URLs by vBSEO 3.2.0