Re: bash 3.2.39 -- race condition

2009-11-30 Thread Marc Herbert
Douglas Moyes a écrit : > I nearly brought down a server today. > > # alias d="perl-script " > A long time ago I read somewhere that aliases are not recommended. I think they do not bring anything on the table compared to functions, do they? Anyway I have always done without them, but witho

Re: IFS handling and read

2009-11-30 Thread Marc Herbert
Eric Blake a écrit : > > This is E4 in the FAQ: > ftp://ftp.cwru.edu/pub/bash/FAQ > > POSIX permits, but does not require, that the final element of a pipeline > be executed in a subshell. Bash uses the subshell, ksh does not. > Variable assignments in a subshell do not affect the parent. I am

Re: IFS handling and read

2009-11-30 Thread Lhunath (Maarten B.)
On 30 Nov 2009, at 11:34, Marc Herbert wrote: > Eric Blake a écrit : >> >> This is E4 in the FAQ: >> ftp://ftp.cwru.edu/pub/bash/FAQ >> >> POSIX permits, but does not require, that the final element of a pipeline >> be executed in a subshell. Bash uses the subshell, ksh does not. >> Variable as

operators available in bash versions

2009-11-30 Thread Gerard
I apologize for asking what is probably a dumb question, but where can I find a definitive listing of what features are available in each version of Bash. For example, I only have access to Bash-4 on my system. I need to know if " $(< " also works on Bash < 4. I also have a few questions regardin

Re: operators available in bash versions

2009-11-30 Thread Lhunath (Maarten B.)
On 30 Nov 2009, at 12:12, Gerard wrote: > > I apologize for asking what is probably a dumb question, but where can > I find a definitive listing of what features are available in each > version of Bash. > > For example, I only have access to Bash-4 on my system. I need to know > if " $(< " also

Re: bash 3.2.39 -- race condition

2009-11-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Marc Herbert on 11/30/2009 3:18 AM: > A long time ago I read somewhere that aliases are not recommended. I > think they do not bring anything on the table compared to functions, do > they? There is one thing that aliases can do that funct

Re: IFS handling and read

2009-11-30 Thread Greg Wooledge
On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote: > Don't use pipelines to send streams to read. Use file redirection instead: > > Instead of ''command | read var'' > Use ''read var < <(command)'' > > I hardly see a need to change the existing implementation. Or for the orig

Re: IFS handling and read

2009-11-30 Thread Marc Herbert
Lhunath (Maarten B.) a écrit : > On 30 Nov 2009, at 11:34, Marc Herbert wrote: > >> Eric Blake a écrit : >>> This is E4 in the FAQ: >>> ftp://ftp.cwru.edu/pub/bash/FAQ > Instead of ''commands | read var'' > Use ''read var < <(commands)'' > I hardly see a need to change the existing implementation

Re: IFS handling and read

2009-11-30 Thread Lhunath (Maarten B.)
On 30 Nov 2009, at 14:10, Marc Herbert wrote: > > Lhunath (Maarten B.) a écrit : >> On 30 Nov 2009, at 11:34, Marc Herbert wrote: >> >>> Eric Blake a écrit : This is E4 in the FAQ: ftp://ftp.cwru.edu/pub/bash/FAQ > >> Instead of ''commands | read var'' >> Use ''read var < <(commands)''

Re: <( error

2009-11-30 Thread Greg Wooledge
On Sat, Nov 28, 2009 at 02:57:45PM +0100, Antonio Macchi wrote: > but, if you don't have hd (hexdump) how can you see the content of a, > for example, strange file > > i mean > > $ ls -l > total 0 > -rw-r--r-- 1 user1 user1 0 2009-11-28 14:56 ? > > $ hd <(ls) > 09 0a

Re: <( error

2009-11-30 Thread Greg Wooledge
On Sat, Nov 28, 2009 at 02:18:37PM +0100, Antonio Macchi wrote: > $ hd <(echo -en \\0{0..3}{0..7}{0..7}) As for this, I wonder if you understand how bash handles this. I know it certainly wasn't obvious to me! Due to the way the parsing is done, the brace expansions inside the proces substitution

Re: IFS handling and read

2009-11-30 Thread Chris F.A. Johnson
On Mon, 30 Nov 2009, Marc Herbert wrote: > Lhunath (Maarten B.) a ?crit : > > On 30 Nov 2009, at 11:34, Marc Herbert wrote: > > > >> Eric Blake a ?crit : > >>> This is E4 in the FAQ: > >>> ftp://ftp.cwru.edu/pub/bash/FAQ > > > Instead of ''commands | read var'' > > Use ''read var < <(commands)''

Re: IFS handling and read

2009-11-30 Thread Chris F.A. Johnson
On Mon, 30 Nov 2009, Greg Wooledge wrote: > On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote: > > Don't use pipelines to send streams to read. Use file redirection instead: > > > > Instead of ''command | read var'' > > Use ''read var < <(command)'' > > > > I hardly see a nee

Re: IFS handling and read

2009-11-30 Thread Lhunath (Maarten B.)
On 30 Nov 2009, at 15:56, Chris F.A. Johnson wrote: > > On Mon, 30 Nov 2009, Greg Wooledge wrote: > >> On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote: >>> Don't use pipelines to send streams to read. Use file redirection instead: >>> >>> Instead of ''command | read var'' >

Re: IFS handling and read

2009-11-30 Thread Chris F.A. Johnson
On Mon, 30 Nov 2009, Lhunath (Maarten B.) wrote: > On 30 Nov 2009, at 15:56, Chris F.A. Johnson wrote: > > > > On Mon, 30 Nov 2009, Greg Wooledge wrote: > > > >> On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote: > >>> Don't use pipelines to send streams to read. Use file red

Re: IFS handling and read

2009-11-30 Thread Andreas Schwab
"Chris F.A. Johnson" writes: >This works with the output of commands, too: > > IFS=- read year month day <<. > $(date +%Y-%m-%d) > . The disadvantage is that the command is executed synchronously. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B

Re: IFS handling and read

2009-11-30 Thread Chet Ramey
Lhunath (Maarten B.) wrote: > Note that 'read' is a bash feature; not a POSIX shell feature. In that > sense, "read" alone is limiting your "portability". So portability in the > meaning of POSIX is out of the question. Pardon me? `read' is a feature of every historical shell and standardize

Re: IFS handling and read

2009-11-30 Thread Lhunath (Maarten B.)
On 30 Nov 2009, at 16:15, Chet Ramey wrote: > > Lhunath (Maarten B.) wrote: > >> Note that 'read' is a bash feature; not a POSIX shell feature. In that >> sense, "read" alone is limiting your "portability". So portability in the >> meaning of POSIX is out of the question. > > Pardon me? `re

Re: operators available in bash versions

2009-11-30 Thread Mike Frysinger
On Monday 30 November 2009 06:12:35 Gerard wrote: > I need to know if " $(< " also works on Bash < 4. it's been around for pretty much all time. bash-2 had it for sure, and that is ancient. -mike signature.asc Description: This is a digitally signed message part.

Re: IFS handling and read

2009-11-30 Thread Marc Herbert
Chris F.A. Johnson a écrit : >Why should it be the last element of a pipeline that is executed in >the current shell and not the first? Because that's POSIX' choice? Because the last element is the last one in the data stream. So it feels more natural to get everything from the last ele

Re: IFS handling and read

2009-11-30 Thread pk
Marc Herbert wrote: > Chris F.A. Johnson a écrit : >>Why should it be the last element of a pipeline that is executed in >>the current shell and not the first? > > > Because that's POSIX' choice? No, POSIX allow either behavior. In fact, it allows any behavior ranging from running all

Re: IFS handling and read

2009-11-30 Thread pk
pk wrote: >> Because that's POSIX' choice? > > No, POSIX allow either behavior. In fact, it allows any behavior ranging > from running all parts in their own subshells, to running all parts in the > current shell. "...each command of a multi-command pipeline is in a subshell environment; as a

Re: operators available in bash versions

2009-11-30 Thread Greg Wooledge
On Mon, Nov 30, 2009 at 11:15:38AM -0500, Mike Frysinger wrote: > On Monday 30 November 2009 06:12:35 Gerard wrote: > > I need to know if " $(< " also works on Bash < 4. > > it's been around for pretty much all time. bash-2 had it for sure, and that > is ancient. It doesn't exist in bash 1.14.7

Re: IFS handling and read

2009-11-30 Thread Greg Wooledge
On Mon, Nov 30, 2009 at 04:21:33PM +, Marc Herbert wrote: > Chris F.A. Johnson a écrit : > >Why should it be the last element of a pipeline that is executed in > >the current shell and not the first? > > Because that's POSIX' choice? Because that's what Korn shell does. (But not pdks

Re: operators available in bash versions

2009-11-30 Thread Mike Frysinger
On Monday 30 November 2009 12:12:17 Greg Wooledge wrote: > On Mon, Nov 30, 2009 at 11:15:38AM -0500, Mike Frysinger wrote: > > On Monday 30 November 2009 06:12:35 Gerard wrote: > > > I need to know if " $(< " also works on Bash < 4. > > > > it's been around for pretty much all time. bash-2 had it

Re: <( error

2009-11-30 Thread Antonio Macchi
Based on your question, I'm guessing you're in bash 3.2 or earlier, where $ echo $BASH_VERSION 3.2.39(1)-release $ cat /etc/issue Debian GNU/Linux 5.0 \n \l your "hd <(echo -en \\0{0..3}{0..7}{0..7})" is expanded as if you had typed "hd <(echo -en \\) <(echo -en \\0001) <(echo -en \\000

Re: operators available in bash versions

2009-11-30 Thread Greg Wooledge
On Mon, Nov 30, 2009 at 12:35:32PM -0500, Mike Frysinger wrote: > On Monday 30 November 2009 12:12:17 Greg Wooledge wrote: > > On Mon, Nov 30, 2009 at 11:15:38AM -0500, Mike Frysinger wrote: > > > On Monday 30 November 2009 06:12:35 Gerard wrote: > > > > I need to know if " $(< " also works on Bash

Re: operators available in bash versions

2009-11-30 Thread Antonio Macchi
Gerard wrote: I apologize for asking what is probably a dumb question, but where can I find a definitive listing of what features are available in each version of Bash. For example, I only have access to Bash-4 on my system. I need to know if " $(< " also works on Bash < 4. I also have a few que

Re: IFS handling and read

2009-11-30 Thread Jan Schampera
Lhunath (Maarten B.) schrieb: > My bad. I was under the impression `read` was a Bourne shell-only thing and not standardized under POSIX. (not personal for you only, I see that very often) It would be nice if people actually read POSIX before they talk about it. Jan

Re: operators available in bash versions

2009-11-30 Thread Allodoxaphobia
(Didn't have the OP on the server to followup to. SRI) > On 30 Nov 2009, at 12:12, Gerard wrote: >> >> I apologize for asking what is probably a dumb question, but where can >> I find a definitive listing of what features are available in each >> version of Bash. >> >> For example, I only have