![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Enviornment Variable in B shell (I call it nested variable) | princelinux | Shell Programming and Scripting | 4 | 07-02-2008 02:35 AM |
| awk computed variable names | craig06y | Shell Programming and Scripting | 4 | 02-05-2008 01:50 PM |
| Can we pass array with call by value in function | ranjithpr | Shell Programming and Scripting | 1 | 12-26-2007 12:22 PM |
| Variable names | Bab00shka | UNIX for Dummies Questions & Answers | 2 | 11-11-2005 11:45 AM |
| Variable names | Bab00shka | Shell Programming and Scripting | 4 | 08-15-2002 12:00 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Variable names within array call
I am trying to write a piece of code that will call a value from an array. There are multiple arrays that I need to call data from. Only one array needs to be used based on the step within the program. The arrays have the names "cue_0", "cue_1", and so on. I can't figure out how to call a value from an array based on the array number (the one after the underscore) and the position within the array. I have been able to get it working when not using a variable in the array name, but putting a variable within the array name makes it stop working. I get an error that says "bad substitution" about the line of code noted below when I replace the "0" with a variable. The code below is the part of my script that I am having trouble with. Any help would be greatly appreciated. Code:
for i in `seq 0 23`; do
let position=i*4+9
tput cup 1 $position
case ${cue_0[$i]} in # I want to replace the "0" in this line with a variable"
0) printf "off" ;;
1) printf "on" ;;
esac
done
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|