bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash script error in array definition.


From: Alf Stockton
Subject: Re: bash script error in array definition.
Date: Fri, 29 May 2009 10:42:38 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Greg Wooledge wrote:
On Wed, May 27, 2009 at 03:33:10AM -0700, straygrey wrote:
Please tell me what is wrong with the following line that I have in a bash
script:-
[code]
TODAYDATE=`date +"%Y%m%d"`
declare -a FiLeS=( $TODAYDATE.TeleformDB.tar.bz2
$TODAYDATE.TeleformDB2.tar.bz2 )
[/code]
When I run it I get:-
Syntax error: "(" unexpected

arc1:~$ dash \h:\w$ x=(a b c)
dash: Syntax error: "(" unexpected

Your script is not being executed by bash.  Most likely you either have
#!/bin/sh at the top of it (with /bin/sh being a link to dash or some
other shell that isn't bash), or you're typing "sh myscript" to run it.

Yep, you are correct and the solution was to place "#!/bin/bash" as the 1st line of the script, rather than "#!/bin/sh".


--
Regards,
Alf Stockton            www.stockton.co.za

If one cannot enjoy reading a book over and over again, there is no use
in reading it at all.
                -- Oscar Wilde




reply via email to

[Prev in Thread] Current Thread [Next in Thread]