![]() |
|
|
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 |
| Interactive Array Menu | gecko2424 | Shell Programming and Scripting | 2 | 07-31-2008 01:19 PM |
| awk selection on fields | amatuer_lee_3 | Shell Programming and Scripting | 3 | 05-13-2008 02:05 AM |
| Opt out selection | drhowarddrfine | Post Here to Contact Site Administrators and Moderators | 5 | 01-24-2008 02:20 AM |
| tray selection | amit kul | UNIX for Advanced & Expert Users | 3 | 07-16-2007 09:31 AM |
| Array and Selection | ZINGARO | Shell Programming and Scripting | 4 | 07-15-2007 09:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Menu help with array selection
Hi there all
I got the following I got multiple arrays named for example STAT_AAAA STAT_AAAB STAT_AAAC STAT_AAAD Now what I want I have chosen an option in a menu to select 1 but I dont want to write for all the same thing so I made it a signle one now what I want is to get STAT_ and than the selected one How is this done? so example ${STAT_AAAA} AAAA should be able to change by selection.. I got AAAA and AAAB also in a variable. ${STAT_ *Variablename*[2]} how can this be done? Many thanx in advance! ![]() |
|
||||
|
Can I use an array in an array?? So I can use someting multiple times instad of making for every array the same? As in ${array${array[*][1]}} I got this now but maybe I can make someting much easyer for this wich also cost less lines ![]() So if I would put the 4 letter words such as XFWT in an array aswell and than call it up inside an array... If I make anny sense that is :P Code:
if [ ${STAT_XFWT[2]} = "running" ]
then
STAT_XFWT[2]='\033[1;32mRunning\033[m'
else
STAT_XFWT[2]='\033[1;31mStopped\033[m'
fi
if [ ${STAT_XMCT[1]} = "up" ]
then
STAT_XMCT[1]='\033[1;32mUP\033[m'
else
STAT_XMCT[1]='\033[1;31mDown\033[m'
fi
if [ ${STAT_XMCT[2]} = "running" ]
then
STAT_XMCT[2]='\033[1;32mRunning\033[m'
else
STAT_XMCT[2]='\033[1;31mStopped\033[m'
fi
if [ ${STAT_XMCA[1]} = "up" ]
then
STAT_XMCA[1]='\033[1;32mUP\033[m'
else
STAT_XMCA[1]='\033[1;31mDown\033[m'
fi
if [ ${STAT_XMCA[2]} = "running" ]
then
STAT_XMCA[2]='\033[1;32mRunning\033[m'
else
STAT_XMCA[2]='\033[1;31mStopped\033[m'
fi
if [ ${STAT_ZAMI[1]} = "up" ]
then
STAT_ZAMI[1]='\033[1;32mUP\033[m'
else
STAT_ZAMI[1]='\033[1;31mDown\033[m'
fi
if [ ${STAT_ZAMI[2]} = "running" ]
then
STAT_ZAMI[2]='\033[1;32mRunning\033[m'
else
STAT_ZAMI[2]='\033[1;31mStopped\033[m'
fi
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|