Hi,
I want to start MY_PROGRAM in a bash script with additional parameters given in the CONFIGURATION_ARRAY.
Actual execution
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
That cannot possibly be your code... BASH does not use // for comments, it uses #.
If your variables contain spaces you need to quote them in double-quote characters, like "$a" and "${CONFIGURATION_ARRAY[@]}" or BASH will split them in unintended ways.
That last "sudo" is probably the only place you don't want to quote them -- you want it to split there, to get normal behavior.
Instead of feeding everything into sudo, I suggest doing this: printf "[%s]\n" $N $M ...so you can tell exactly what arguments you're actually getting with those different methods.
Last edited by Corona688; 08-15-2014 at 12:38 PM..
What is your intention with those // ? I'm pretty sure bash doesn't like those; you should get plenty of error msgs therefor.
And, why should it make any difference when calling it with $N $M parameters as opposed to $a $b? you don't use positional parameters anyhow in your code.
Pay attention to trailing spaces when extracting and comparing your variables...
Hi,
the // comments are only for you, I don't use them in my script.
I use IFS="'" for the strings in my array.
the output is:
But my program doesn't work with this call:
But if I use another variable, let's say this one:
and I call my program:
That's almost certainly related to your issue... IFS controls all splitting! So your script is effectively being forcefed each element as one parameter like:
instead of being split like you'd want, into
...because that string contains no single-quotes to split upon.
Anyway, you don't need to set IFS here at all. It only controls how unquoted strings work in an array, it has nothing to do with the behavior of quotes themselves. Just be sure to quote your variables where you don't want them to split!
The quotes in red are special. When you put double-quotes around $@ or ${ARRAY[@]} it splits on array elements and not IFS.
This outputs:
Last edited by Corona688; 08-15-2014 at 12:55 PM..
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)
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)
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)
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)
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)
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)
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)