-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralf Mardorf wrote:
> Gustin Johnson wrote:
<snip>
>> Try the following one line at a time from a shell, it should not
>> matter if you are root:
>> 
>> declare -a  sourcedir=( "/etc" "/usr/local" "/var/log" )
>> 
>> elements="${#sourcedir[*]}"
>> 
>> for (( i = 0  ; i < $elements ; i++ )) ; do echo ${sourcedir[$i]} ;
>> done
>> 
>> Do you see any errors at any stage?  If so what are they?  If not
>> what is the output from the final line?
>> 
>> If you do see an error, what version of bash are you using ("bash -
>> --version" will tell you)?
>> 
> 
<snip>
> spinymouse-s...@64studio:~$ sh test.bin?sh test.bin\sh: 2: Syntax
> error: "(" unexpected spinymouse-s...@64studio:~$ sh test.bin?bash 
> test.bin\bash: 2: Syntax error: "(" unexpected 

That is the error you get when using /bin/sh (aka /bin/dash due to the
symlink).

> spinymouse-s...@64studio:~$ bash --version GNU bash, version
> 3.2.39(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2007 Free
> Software Foundation, Inc. spinymouse-s...@64studio:~$
> 
>> In my experience, Bash is the most common, followed by ash
> 
> The problem that bash for Ubuntu doesn't know arrays is known. IIUC
> bash = POSIX ¬ POSIX = no arrays
> 
Nope, you are wrong in this case.  I tested that array code on three
physically different Ubuntu Systems  (8.04, 9.04, and 9.10
beta) as well as my 64Studio 3Beta system.  *All* systems passed (ie.
they worked the same and as expected all of the machines handled the
array properly).  I have not installed nor built a custom version of
bash, I used whatever version the distro came with.

Please execute those lines one at a time, do *NOT* put them in a script.
     This is what I mean about testing.  Keep it simple and break it down.

Then if you get no errors, you can put them in a script.  Make the
script(s) executable with chmod u+x <scriptname> then ./scriptname to
run the script.  Do *NOT* preface the script with sh, this will force
your OS to use /bin/sh regardless of the shebang line at the top of your
script.  /bin/sh is a symlink to /bin/dash which does not support arrays.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFK1TNfwRXgH3rKGfMRAnxTAKCxvABNCCG8JoM5O+LaCT/Zhk16hACgmpX/
rgzzr46aOzf3j8BJqPLMhV0=
=/LZ+
-----END PGP SIGNATURE-----
_______________________________________________
64studio-users mailing list
[email protected]
http://lists.64studio.com/mailman/listinfo/64studio-users

Reply via email to