Wow guys I definitely found my mistake... my counter was wrongly initiated, nothing more
Thanks anyway for readers :P
Hi there,
I'm new here but did already use the forum with help of Google to find a lot of answers, so thanks already to all.
Not so good english, sorry for this :P
Here is a little bash script I'm working on cygwin, I think it will be easy for you to help me :
Code:
count=3
for param in $3 $4 $5 $6 $7 $8 $9 ; do
if [ ! -z $param ] ; then
file[$count]=${param/$1/$2}
let "count += 1"
echo Array contains : ${file[*]} #debugging line
fi
done
echo ${file[1]} #debugging lines
echo ${file[2]} #
Now the output is :
Code:
Array contains : v:\data\ascor\loel
Array contains : v:\data\ascor\loel v:\haha
Array contains : v:\data\ascor\loel v:\haha v:\loel
Array contains : v:\data\ascor\loel v:\haha v:\loel v:\jaj
Note that Input one and two are drive letters, and 3-9 are file paths, just to understand this :
Code:
file[$count]=${param/$1/$2}
As you can see on the output of the script, the two 'testing echoes' I do at the end don't print anything.
That's the point, I do NEED this array further in my script.
I'd understand my "param" var is local to the for, but is the other one too ? I tried to use "declare -a file" before the for, but i get same exact result !
Thanks guys, I hope I'll find before my brain melts of attempts...