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

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 09-04-2008
msb65 msb65 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 89
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?
  #2 (permalink)  
Old 09-04-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Code:
eval variable=\${$parameter_number}
  #3 (permalink)  
Old 09-04-2008
msb65 msb65 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 89
Hi,

Thank you that works beautifully.

Mike
Closed Thread

Bookmarks

Tags
eval, variable

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 06:04 PM.


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