Sponsored Content
Full Discussion: Strange type mistake?!
Top Forums Shell Programming and Scripting Strange type mistake?! Post 302913321 by xraystorm on Friday 15th of August 2014 09:29:43 AM
Old 08-15-2014
Strange type mistake?!

Hi,
I want to start MY_PROGRAM in a bash script with additional parameters given in the CONFIGURATION_ARRAY.

Code:
IFS="'"
CONFIGURATION_ARRAY=( '-N 0 -m 0' '-N 0 -m 1'  )
for configuration in ${CONFIGURATION_ARRAY[@]}
do

//DEBUG
N=${configuration%-*} //-N 0
M=-${configuration##*-} //-m 0
a="-N 0"
b="-m 0"
printf "%s \n" $N //-N 0
printf "%s \n" $a //-m 0
if [ $N == $a ]
then
           echo "SAME" //it's not the same - WHY???
fi

if [ $M == $b ]
then
           echo "SAME" //it's the same
fi

Actual execution
Code:
sudo  ./MY_PROGRAM $configuration //I want this to work but: doesn't work
sudo  ./MY_PROGRAM $N $M //doesn't work
sudo  ./MY_PROGRAM $N //doesn't work
sudo  ./MY_PROGRAM $M //works!!! 
sudo  ./MY_PROGRAM $a $b //works!!! but a and b contain the same strings as N and M do.. what the hell?

I have absolutly no idea, I already spent hrs on this... can someone please help me? What's the difference between variable N and variable a? It contains the same and both are strings... but the programm only works with a.

Last edited by rbatte1; 08-15-2014 at 10:51 AM.. Reason: Break up the code and the output
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Crontab Mistake!!!

Hi. I hope someone can help me with this problem. Being a novice to Unix, I editted my crontab directly by typing " crontab -e ". Well, I needed to make some changes so, I typed " crontab -r ". Now I have no crontab, and I can't seem to get crontab to write a new file. I' ve tried: vi... (4 Replies)
Discussion started by: cstovall
4 Replies

2. Shell Programming and Scripting

String type to date type

Can one string type variable changed into the date type variable. (1 Reply)
Discussion started by: rinku
1 Replies

3. Programming

array type has incomplete element type

Dear colleagues, One of my friend have a problem with c code. While compiling a c program it displays a message like "array type has incomplete element type". Any body can provide a solution for it. Jaganadh.G (1 Reply)
Discussion started by: jaganadh
1 Replies

4. AIX

Did a Mistake with HACMP

Hi, I needed space on a FS, and when I've added the space on the filesystem, I did it trough the regular smitty fs inteface and not with smitty cl_lvm. Can someone help me to repair the situat before a faileover happen ? Thanks for your help,:mad: (13 Replies)
Discussion started by: azzed27
13 Replies

5. Shell Programming and Scripting

Is there any mistake in this code:

cat $1 | sort -n | uniq | $1 in other words, I sort the content of the file and put the ouput in the same file, is there any mistakes in this cshell code ??? (4 Replies)
Discussion started by: Takeeshe
4 Replies

6. UNIX for Dummies Questions & Answers

Probably some stupid mistake...

Hi everyone ! I have a file wich look like this : >Sis01 > Sis02 ... >Sis44 I want to separe each paragraphe in a different file, so I decide to use the "FOR" loop + sed. for f in {01..44} do (5 Replies)
Discussion started by: sluvah
5 Replies

7. UNIX for Dummies Questions & Answers

Can anyone help me to spot my mistake?

Hi there can anyone help me to spot my mistake and please explain why it appears My code : #!/usr/bin/gawk -f BEGIN { bytes =0} { temp=$(grep "datafeed\.php" | cut -d" " -f8) bytes += temp} END { printf "Number of bytes: %d\n", bytes } when I am running ./q411 an411 an411: ... (6 Replies)
Discussion started by: FUTURE_EINSTEIN
6 Replies

8. Programming

Strange value of the double type variable: -nan(0x8000000000000)

I am confused by the value of "currdisk->currangle" after adding operation. Initially the value of "currdisk->currangle" is 0.77500000000000013, but after adding operation, it's changed to "-nan(0x8000000000000)", Can anyone explain ? Thanks! The following is the occasion of gdb debugging. 3338 ... (8 Replies)
Discussion started by: 915086731
8 Replies
VTYSH(1)							   Version 0.88 							  VTYSH(1)

NAME
vtysh - a integrated shell for Zebra routing software SYNOPSIS
vtysh [ -e command ] DESCBGPTION
vtysh is a integrated shell for Zebra routing engine. OPTIONS
-e Specify command to be executed under batch mode. COMMANDS
Almost Zebra commands. ping traceroute telnnet start-shell start-shell bash start-shell zsh FILES
/usr/local/etc/Zebra.conf The default location of the vtysh config file. WARNING
This man page is intended as a quick reference for command line options, and for config file commands. The definitive document is the Info file Zebra. SEE ALSO
References to other related man pages: bgpd(8), ripd(8), ripngd(8), ospfd(8), ospf6d(8), zebra(8) BUGS
vtysh eats bugs for breakfast. If you have food for the maintainers try <bug-zebra@gnu.org> AUTHOR
[S] See <www.zebra.org>, or the Info file for an accurate list of authors. Zebra Beast - VTY shell July 2000 VTYSH(1)
All times are GMT -4. The time now is 04:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy