![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| compound variable in korn shell | ZINGARO | Shell Programming and Scripting | 5 | 10-03-2007 10:57 AM |
| compound variable in korn shell | ZINGARO | Shell Programming and Scripting | 0 | 08-30-2007 11:30 AM |
| awk compound statements | gfhgfnhhn | Shell Programming and Scripting | 7 | 07-17-2006 01:15 PM |
| Compound indirect variable references | tkrussel | UNIX for Advanced & Expert Users | 5 | 08-21-2005 10:03 AM |
| Trying to use 'compound variable' in a script | irina | Shell Programming and Scripting | 1 | 01-29-2004 10:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Trying to use 'compound variable' in a script
Hi there - am newish to shell scripting and would appreciate some advice on this...
Am trying to use what I have seen called 'compound variables' in other langs but with no success in my shell script. This is the kind of thing I'm trying to do: base_val=123 stop=3 x=1 while [ $x -le $stop ] do array_var[$x] = `expr $base_val + $x` echo $x $array_var[$x] x=`expr $x + 1` done The value of x is being incremented, but it is not being substituted as an index in the array variable called array_var. Here's the output: ./t2.ksh[8]: array_var[1]: not found 1 [1] ./t2.ksh[8]: array_var[2]: not found 2 [2] ./t2.ksh[8]: array_var[3]: not found 3 [3] Is this completely the wrong approach, or is it an issue with the syntax?. What's the best way to achieve this? Thanks in advance, Neemic........: |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|