Re: bash script error in array definition.

2009-05-29 Thread Alf Stockton

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 Stocktonwww.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




Re: bash script error in array definition.

2009-05-29 Thread straygrey



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". Thank you.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/bash-script-error-in-array-definition.-tp23739928p23776461.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.





Really minor bug. Curent working directory: "//"

2009-05-29 Thread pbd
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd7.1
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd7.1' -DCONF_MACHTYPE='i386-portbld-freebsd7.1' 
-DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include 
-O2 -fno-strict-aliasing -pipe
uname output: FreeBSD cht0n.bns.tns.cz 7.1-RELEASE-p2 FreeBSD 7.1-RELEASE-p2 
#0: Wed Apr 22 13:13:55 CEST 2009 
p...@cht0n.bns.tns.cz:/usr/obj/usr/src/sys/CHT0N-4  i386
Machine Type: i386-portbld-freebsd7.1

Bash Version: 4.0
Patch Level: 24
Release Status: release

Description:
Really minor bug. Bash returns "//" as current working directory after 
changing directory to "//". Changing directory to "///" ("or to more slashes") 
results in "/" as current working directory.

Repeat-By:
cd //
  pwd





Re: Really minor bug. Curent working directory: "//"

2009-05-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to p...@safe-mail.net on 5/29/2009 3:34 AM:
> Description:
>   Really minor bug. Bash returns "//" as current working directory after 
> changing directory to "//". Changing directory to "///" ("or to more 
> slashes") results in "/" as current working directory.

Not a bug.  POSIX allows // to be a different directory than /, and on
some platforms, such as cygwin, this is actually the case.  Therefore,
bash is required to be careful of //.

- --
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkof08MACgkQ84KuGfSFAYBmTACfYYvVeeiYzi6oRhmLDOkm1Ezl
MYQAoKYeHB2aJCXc3TabESsvnvxiON9n
=3c5B
-END PGP SIGNATURE-




Help help missing m option in synopsis

2009-05-29 Thread Chris F.A. Johnson

The synopsis for the help builtin is missing the -m option:

help: help [-ds] [pattern ...]

Also, the PATTERN is not a pattern in the usual sense, it the
beginning of a command:

$ help -d c
caller - Return the context of the current subroutine call.
case - Execute commands based on pattern matching.
cd - Change the shell working directory.
command - Execute a simple command or display information about commands.
compgen - Display possible completions depending on the options.
complete - Specify how arguments are to be completed by Readline.
compopt - Modify or display completion options.
continue - Resume for, while, or until loops.
coproc - Create a coprocess named NAME.

   As a result, it is not possible to have help print just the help
   for time or read, for example, they always include times,
   readarray, and readonly:

$ help -d time read
time - Report time consumed by pipeline's execution.
times - Display process times.
read - Read a line from the standard input and split it into fields.
readarray - Read lines from a file into an array variable.
readonly - Mark shell variables as unchangeable.

-- 
   Chris F.A. Johnson, webmaster 
   ===
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




Re: Help help missing m option in synopsis

2009-05-29 Thread Andreas Schwab
"Chris F.A. Johnson"  writes:

>As a result, it is not possible to have help print just the help
>for time or read, for example, they always include times,
>readarray, and readonly:

$ help -d "t*ime" "r*ead"
Shell commands matching keywords `t*ime, r*ead'

time - Report time consumed by pipeline's execution.
read - Read a line from the standard input and split it into fields.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Re: Bash loadable plugins ... minimal header file?

2009-05-29 Thread Mike Frysinger
On Thursday 28 May 2009 05:14:50 Dr. Werner Fink wrote:
> AFAICS from examples/loadables/ a lot of headers are readed
> by the compiler which requires - beside the bash and the
> readline library - an further package (rpm/deb) bash-devel
> for including all those headers ... beside this the Makefiles
> do not install any of them.
>
> Therefore my question: how does a minimal header looks like?
> It should include the API for the argument handling and
> clearly the declarations found in builtins.h after the
> includes.
>
> My wish is to have a few minimal header files without installing
> nearly all header files.

i think that sounds like a pretty good idea.  but i havent looked to see what 
kind of changes need to be made to the build system to support that.
-mike


signature.asc
Description: This is a digitally signed message part.


missing dependencies in bash Makefile

2009-05-29 Thread Mike Frysinger
the Makefile is missing the following dependencies (sure wish this list was 
autogenerated ...):
 - subst.o: ${DEFDIR}/builtext.h
 - many objects that use shell.h but dont declare pathnames.h

a grep on the Makefile shows that like 83 objects depend on shell.h but only 
about 40 of those depend on pathnames.h

Peter Alfredsen  pointed out most of these issues
-mike


signature.asc
Description: This is a digitally signed message part.


Re: bash-3.2 multibyte behavior on Solaris

2009-05-29 Thread Chet Ramey
Jan Hnatek wrote:
> Hi,
> 
> bash-3.2 on Solaris is suffering from the following bug:
>  http://defect.opensolaris.org/bz/show_bug.cgi?id=3743
>  (bash hangs sometimes when navigating with the arrow keys)

The problem is that different implementations of mbrtowc return different
values when `n' is 0.  Try this patch; it fixes that underlying problem.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
*** lib/readline/mbutil.c.orig  2009-05-29 23:09:26.0 -0400
--- lib/readline/mbutil.c   2009-05-29 23:10:12.0 -0400
***
*** 78,82 
   int seed, count, find_non_zero;
  {
!   size_t tmp;
mbstate_t ps;
int point;
--- 78,82 
   int seed, count, find_non_zero;
  {
!   size_t tmp, len;
mbstate_t ps;
int point;
***
*** 99,103 
while (count > 0)  
  {
!   tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
--- 99,106 
while (count > 0)  
  {
!   len = strlen (string + point);
!   if (len == 0)
!   break;
!   tmp = mbrtowc (&wc, string+point, len, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{