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
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 09:25 AM
awk arrays imonthejazz Shell Programming and Scripting 1 09-21-2007 06:29 AM
Problem setting up Bash user account sumanroyc UNIX for Advanced & Expert Users 2 10-27-2006 02:57 PM
Query regarding alias and setting bash as a default script VENC22 UNIX for Dummies Questions & Answers 1 07-13-2005 06:18 AM
KSH and arrays whited05 Shell Programming and Scripting 1 06-24-2005 09:07 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-19-2001
Registered User
 

Join Date: Jul 2001
Posts: 2
bash: setting arrays

Ok, I searched the threads a couple of times but couldn't find anything really relevant. Here's my problem, maybe you can help:

I am running version 1.14.7 of the bash shell, on Red Hat Linux. I am trying to set an array like so:

bash$> letters=(x y z)

spaces are between the letters but not between the parenthesis and the equals

Now, on version 2.01.1 running on a Sun machine that command works fine, the array set properly, but for some reason it won't take on the older version. This must mean that i'm doing it wrong and the old version has a different way to set arrays. If someone knows the answer as to whether or not you can do this on the old version and how it's done, i would really appreciate it.

The catches are that the one system is not mine and I don't have the authority to upgrade the bash shell to the newer version, and the scripts I wish to create and run must be run on the system with the old bash shell. I've also checked the bash manual for this old version and didn't really find anything of use. Maybe I missed something, please help if you can. Thanks.

K
Forum Sponsor
  #2  
Old 07-19-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Have you tried explicitly seeting the values:

letters[0]="x"
letters[1]="y"
letters[2]="z"


  #3  
Old 07-20-2001
Registered User
 

Join Date: Jul 2001
Posts: 2
Yes, i tried setting it explicitly but it won't take it. It gives me back the line:
letter[0]=x: command not found

I've tried doing it other ways also (w/ and w/out quotes, setting the variable to a single letter first i.e. letter=x then setting the next index
letter[1]=x) Just different things to that effect and i haven't found one that works yet.

Any more suggestions would be greatly appreciated.
  #4  
Old 07-20-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
I would consider upgrading to the newer version then:

http://www.rpmfind.net/linux/RPM/red...4-11.i386.html
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:37 AM.


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