Bad Number Error


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Bad Number Error
# 1  
Old 06-29-2006
Bad Number Error

What is wrong with my syntax, I am getting bad number error. The following lines of code get the value from INI file but the variable is a combination of multiple variables. When compiling all together, I get a bad number error or changing the '((' with '{{' gets me bad substitution error. The code works if the return value is a numeric but it fails when it is a TXT. What is the best way to tackle this, any one? INI Example is at the end

SERV_CNT=1
function start {
TOT_SERV=`echo NUMBER_OF_${APPLICATION}_SERV`
while [[ $SERV_CNT -le $TOT_SERV ]]
do
#SERVER=${FIN_P1_[$SERV_CNT]}
SERVER=$((${APPLICATION}_${SERV}_[$SERV_CNT]))
#$WEB_HOME/$START_SCRIPT $SERVER
let SERV_CNT=$SERV_CNT+1
done
}


INI File:
NUMBER_OF_FIN_SERV=6

FIN_P1_[1]=FINPROD
FIN_P1_[2]=FINPROD02
FIN_P1_[3]=FINPROD03
FIN_P1_[4]=FINPROD04
FIN_P1_[5]=FINPROD05
FIN_P1_[6]= FINPROD06

Smilie Smilie
# 2  
Old 06-29-2006
Here is one way...
Code:
$ cat x
#! /usr/bin/ksh


SERV_CNT=1
function start {
        eval TOT_SERV=\$NUMBER_OF_${APPLICATION}_SERV
        while [[ $SERV_CNT -le $TOT_SERV ]] ; do
                eval SERVER=\${${APPLICATION}_${SERV}_[SERV_CNT]}
                echo $SERV_CNT $SERVER
                ((SERV_CNT=SERV_CNT+1))
        done
return 0
}


NUMBER_OF_FIN_SERV=6
FIN_P1_[1]=FINPROD
FIN_P1_[2]=FINPROD02
FIN_P1_[3]=FINPROD03
FIN_P1_[4]=FINPROD04
FIN_P1_[5]=FINPROD05
FIN_P1_[6]=FINPROD06
APPLICATION=FIN
SERV=P1
start
exit 0
$ ./x
1 FINPROD
2 FINPROD02
3 FINPROD03
4 FINPROD04
5 FINPROD05
6 FINPROD06
$

# 3  
Old 06-30-2006
Thank you so much, this works wonderful

Thank you so much, you have saved my day Smilie , appreciate a lot. Once again thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

File System Error: BAD SUPERBLOCK AT BLOCK 16: NUMBER OF DIRECTORIES OUT OF RANGE

Hi All, we are having a file system error in one of our servers. The server failed to boot in usual user mode. Instead boot with single user mode and requesting to run a FSCK manually to repair the corrupted. see the below output. Netra T2000, No Keyboard Copyright 2008 Sun Microsystems,... (5 Replies)
Discussion started by: Buddhike G
5 Replies

2. Solaris

Bad magic number error

So we have a new to us v240 server with no OS installed. It has an outdated version of OB and ALOM so before we install the OS we want to update both. We have a DVD with the latest OB patch burned on it. We do the boot cdrom command but receive the Bad Magic Number Error. Does an OS need to... (2 Replies)
Discussion started by: dunkpancakes
2 Replies

3. Solaris

Solaris 8.2 Bad magic number

I'll keep it fairly straight forward. I work with a Solaris server and magically today it decided to take a dump on me. At first it give a long list of files that couldn't be acessed before terminating the boot process and returning to the 'ok' prompt. Booting in single-user mode allowed me to run... (4 Replies)
Discussion started by: Aon
4 Replies

4. Solaris

OpenSolaris 2009 bad magic number

Hi guys, I have a big problem wiht my old Netra T1 200. I want to install OpenSolaris 2009 but there's a problem, I burned the ISO image on a CD-RW and then I tryied to install it on netra, but the setup won't to start and the error is that in the attached image. Thanks for the support and sorry... (5 Replies)
Discussion started by: Ducati87
5 Replies

5. Solaris

Bad File Number

System Solaris 8 When I open a CONSOLE window the following starts scrolling: "ServiceCommand: :write: Bad FIle Number" This will continue to scroll without stopping. However, you can type while it is scrolling and login into root and even conduct business within the CONSOLE window. The... (1 Reply)
Discussion started by: Kevin1166
1 Replies

6. UNIX for Advanced & Expert Users

Bad magic number on /dev/md0

Hello All, (RHEL4) Few weeks ago I had posted a message in this forum about the problem I had when I replaced my two scsi disks and tried rebuild raid1 array. I somehow managed to up the system with working raid1 array. But the main problem persisted.. i.e when I reboot the system, mounting... (0 Replies)
Discussion started by: ravinandan
0 Replies

7. Shell Programming and Scripting

Error Message - ./dsp_svrconn.sh[41]: MBHD1: bad number

Hi Experts, I have a shell script in which I have the following if condition. if then CHLREP=`echo "$DSPLINE MCAUSER" | \ \opt\mqm\bin\runmqsc -e $QMGRNAME | \ "ALTER CHANNEL($CHANNEL) CHLTYPE(SVRCONN) MCAUSER('HAK')"` echo "$CHLREP" fi When I run this... (1 Reply)
Discussion started by: hkhan12
1 Replies

8. Filesystems, Disks and Memory

Bad Magic Number

Dear All, i have a SCSI hard disk drive i'm installing on it solaris 5 and the workstation is sun sparc, i made an image of this H.D using Norton Ghost 6, so i took off the SCSI H.D from the sun workstation and put it on a Compaq server then i booted the server from the Norton Ghost floppy disk... (0 Replies)
Discussion started by: wesweshahaha
0 Replies

9. Shell Programming and Scripting

How can you Test for bad number

Anyone know the code to test for bad numbers? For example in ksh... Want the user to input an integer, but they input characters. read number while (number = letter) read number //until valid number is inputted thx for any help!! :confused: (3 Replies)
Discussion started by: gsxpower
3 Replies

10. UNIX for Advanced & Expert Users

bad magic number

Hi, when installing a piece of third part software I get the error "Bad magic number" at one point when it tries to use libraries from the bea tuxedo server. Am I correct that this means that the software is expecting 32bit while I'm on 64bit? Is there a way around it or can it only be solved... (5 Replies)
Discussion started by: rein
5 Replies
Login or Register to Ask a Question