Re: commented quotes in subshells cause syntax errors

2006-04-15 Thread Chet Ramey
Mike Frysinger wrote: > On Friday 14 April 2006 22:52, Chet Ramey wrote: >>> >>> foo=$( #' >>> echo hi) >> This has already been fixed for the next version. > > when you say "next version" you mean like bash-3.2 right ? Yeah, I mean like bash-3.2. :-) Chet -- ``The lyf so short, the craft so

test -f with no args is true

2006-04-15 Thread Charlie Bennett
I'm running bash 3.0. I'm seeing the same thing in the Fedora 4 distributed version and in a copy built from the stable tarball. Is this expected behavior? [EMAIL PROTECTED] .ssh]# [ -f ] [EMAIL PROTECTED] .ssh]# echo $? 0 All of the file test ops behave the same way. in test.c, we call pos

Unable to compile bash 3.1 on HP-UX 11i Version 2 Itanium

2006-04-15 Thread John Lanier
Hello, Below is the report I sent via bashbug from my root account on the HP-UX system in question, but email is only setup for forwarding on that system; hence, I am sending the bashbug report via my regular email account. Regards, --John Lanier Below is from the bashbug report:

Re: test -f with no args is true

2006-04-15 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Charlie Bennett on 4/14/2006 9:17 AM: > Is this expected behavior? > > [EMAIL PROTECTED] .ssh]# [ -f ] > [EMAIL PROTECTED] .ssh]# echo $? > 0 Yes. POSIX requires 'test' (aka '['), when handed exactly one argument, to return 0 if it is

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Charlie Bennett wrote: > Is this expected behavior? > > [EMAIL PROTECTED] .ssh]# [ -f ] > [EMAIL PROTECTED] .ssh]# echo $? > 0 Yes. That is expected behavior. With one argument the return code is true if the string is non-zero in length. The case covered is this case: if [ "$variable" ]; t

Re: test -f with no args is true

2006-04-15 Thread Paul Jarc
Charlie Bennett <[EMAIL PROTECTED]> wrote: > Is this expected behavior? > > [EMAIL PROTECTED] .ssh]# [ -f ] > [EMAIL PROTECTED] .ssh]# echo $? > 0 Yes. A single argument is considered true if it is not the mepty string, even if it happens to coincide with the spelling of an operator. This is ho

Re: test -f with no args is true

2006-04-15 Thread cbennett
H. I sat on that blasted committee. I'll file a corrigendum or whatever it's called. This should at least be called out in the rationale. No biggie. I'll just make sure I quote all of my args. ccb > Charlie Bennett wrote: >> Is this expected behavior? >> >> [EMAIL PROTECTED] .ssh]# [ -

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Charlie Bennett wrote: > H. I sat on that blasted committee. :-) > I'll file a corrigendum or whatever it's called. This should at > least be called out in the rationale. > > No biggie. I'll just make sure I quote all of my args. Yes, because test and [ were external commands when the AP

`if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Herculano Einloft
Hey all, $ if $(echo string >/dev/null); then echo true; fi true This should be a syntax error, since $ if; then echo true; fi bash: syntax error near unexpected token `;' Tested on GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu) Copyright (C) 2002 Free Software Foundation, In

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Andreas Schwab
Herculano Einloft <[EMAIL PROTECTED]> writes: > Hey all, > > $ if $(echo string >/dev/null); then echo true; fi > true > > This should be a syntax error No, it is a perfectly valid command, syntactically. That the command substitution expands to nothing has no significance any more once the c

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Mike Frysinger
On Saturday 15 April 2006 19:55, Herculano Einloft wrote: > $ if $(echo string >/dev/null); then echo true; fi > true > > This should be a syntax error, since > > $ if; then echo true; fi > bash: syntax error near unexpected token `;' the first command statement is more like: if :; then echo true;

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Herculano Einloft
Em (02:25:11), Andreas Schwab escreveu: > >> Hey all, >> >> $ if $(echo string >/dev/null); then echo true; fi >> true >> >> This should be a syntax error > >No, it is a perfectly valid command, syntactically. That the command >substitution expands to nothing has no significance any more

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Herculano Einloft
Em (21:43:32), Mike Frysinger escreveu: >On Saturday 15 April 2006 19:55, Herculano Einloft wrote: >> $ if $(echo string >/dev/null); then echo true; fi >> true >> >> This should be a syntax error, since >> >> $ if; then echo true; fi >> bash: syntax error near unexpected token `;' > >th

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Herculano Einloft
Em (02:25:11), Andreas Schwab escreveu: >Herculano Einloft writes: > >> Hey all, >> >> $ if $(echo string >/dev/null); then echo true; fi >> true >> >> This should be a syntax error > >No, it is a perfectly valid command, syntactically. That the command >substitution expands to nothing

Re: test -f with no args is true

2006-04-15 Thread Chet Ramey
Bob Proulx wrote: > As an alternative, you could use the [[ ... ]] syntax. That is the > newer syntax, covered in POSIX too so should be portable to POSIX > systems, but is always a built-in to the shell. POSIX declined to standardize [[...]]. It just happens to appear in `posix shells' descend

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Chet Ramey wrote: > Bob Proulx wrote: > > As an alternative, you could use the [[ ... ]] syntax. That is the > > newer syntax, covered in POSIX too so should be portable to POSIX > > systems, but is always a built-in to the shell. > > POSIX declined to standardize [[...]]. It just happens to app