The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 10-14-2008
draco draco is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 38
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