Hi Gustin :)
>> test.bin\bash: 2: Syntax error: "(" unexpected
>>
>
> That is the error you get when using /bin/sh (aka /bin/dash due to the
> symlink).
>
/bin/sh is linked with dash and /bin/bash isn't a link, it's bash, both
by default for 64 Studio 3.0-beta3 amd64, I didn't changed this.
Some posts in the www for Ubuntu, not 64 Studio, said the same for
Ubuntu ... but see below, no "we" know the reason why ;).
>> 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.
>
This is strange. I didn't change anything too.
> Make the script(s) executable with chmod u+x <scriptname> then ./scriptname to
> run the script.
I do know this, but I like to use "sh", because it's the simplest and
fastest way to work ... the way I do work ;).
> 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.
>
:D
spinymouse-s...@64studio:~$ gedit
spinymouse-s...@64studio:~$ chmod u+x test
spinymouse-s...@64studio:~$ ./test
/etc
/usr/local
/var/log
spinymouse-s...@64studio:~$ cat obsession0.5
#!/bin/sh
#######################################
# Obsession - Open Busy Session Handler
# 2009 Ralf Mardorf
#######################################
obs_version="0.5"
[snip]
# Restore
obs_rst_app=1
while [ $obs_rst_app -le $obs_number_of_apps_to_be_restored ]
do
echo "Launching app number $obs_rst_app of
$obs_number_of_apps_to_be_restored apps to be restored."
eval run="\${obs_rst${obs_rst_app}}"
`$run` &
sleep $obs_delay
obs_rst_app=`expr $obs_rst_app + 1`
done
#
obs_quit_msg_flag=0
;;
esac
fi
fi
if [ $obs_quit_msg_flag = 1 ] ; then echo "quit "$0 ; fi
echo
exit 0
spinymouse-s...@64studio:~$
The question still is, if arrays are POSIX?! I would like to use arrays
instead of this "eval"ed variables.
Cheers,
Ralf
_______________________________________________
64studio-users mailing list
[email protected]
http://lists.64studio.com/mailman/listinfo/64studio-users