Re: Syntax Question...

2011-08-16 Thread Ken Irving
On Tue, Aug 16, 2011 at 03:41:19PM -0700, Linda Walsh wrote: > Ken Irving wrote: > >It seems to me that there are real bugs in applying set -e that can only > >be fixed by handling more special cases in the bash code,and those cases > >may vary for different scripts. > > >[snip] > >set ... > >

Re: Syntax Question...

2011-08-16 Thread Dennis Williamson
On Tue, Aug 16, 2011 at 4:11 PM, Linda Walsh wrote: > > > > Dennis Williamson wrote: >> > >   Who's Greg?  I mean before some days ago and other than seeing the name on > this list, who is he from Adam that someone should think his FAQ is > important? > I don't know the name other than from s

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
Ken Irving wrote: On Mon, Aug 15, 2011 at 08:19:01PM -0700, Linda Walsh wrote: today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )" This one is so bad, I saved it for last. Ack! Pt! Wait, what? Why? What the? Huh? ... What would you do to search for fil

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
Dennis Williamson wrote: On Mon, Aug 15, 2011 at 10:19 PM, Linda Walsh wrote: How do I determine the location of my script? http://mywiki.wooledge.org/BashFAQ/028 ??? I don't understand the need for complexity -- what I have works. Its a few lines@ most -- I use the same in per

Re: Syntax Question...

2011-08-16 Thread Dennis Williamson
On Tue, Aug 16, 2011 at 11:45 AM, Ken Irving wrote: > > I'm guessing the 'Ack!' was maybe for 'useless use of subshell'? > > No, it was for the ls. -- Visit serverfault.com to get your system administration questions answered.

Re: Syntax Question...

2011-08-16 Thread Ken Irving
On Mon, Aug 15, 2011 at 08:19:01PM -0700, Linda Walsh wrote: > >>today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )" > > > >This one is so bad, I saved it for last. Ack! Pt! Wait, what? Why? > >What the? Huh? > ... > What would you do to search for files w/wild cards and return th

Re: Syntax Question...

2011-08-16 Thread Dennis Williamson
On Mon, Aug 15, 2011 at 10:19 PM, Linda Walsh wrote: > > >> >> How do I determine the location of my script? >> http://mywiki.wooledge.org/BashFAQ/028 >> > > ???  I don't understand the need for complexity -- what I have works.  Its a > few > lines@ most -- I use the same in perl.  has worked for

Re: multibyte support for ansic_* functions

2011-08-16 Thread Roman Rakus
On 08/16/2011 03:42 PM, Roman Rakus wrote: The following two patches add support for multibyte characters in ansic_* functions. Effectively it is changing behaviour of: 1) printf's %q format option 2) command not found error message 3) readline's syntax error message 4) XTRACE output It's a set

[PATCH 1/2] Multibyte characters support for ansic_shouldqoute()

2011-08-16 Thread Roman Rakus
Properly check for printable characters in ansic_shouldqoute(). Use wchar_t* and iswprint() instead of isprint() and char*. Signed-off-by: Roman Rakus --- bash-4.2/lib/sh/strtrans.c | 26 +- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/bash-4.2/lib/sh

multibyte support for ansic_* functions

2011-08-16 Thread Roman Rakus
The following two patches add support for multibyte characters in ansic_* functions. Effectively it is changing behaviour of: 1) printf's %q format option 2) command not found error message 3) readline's syntax error message 4) XTRACE output It's a set of two patches.

[PATCH 2/2] Multibyte support for ansic_quote() function

2011-08-16 Thread Roman Rakus
Correctly check for printable characters using wchar_t* and iswprint(). Signed-off-by: Roman Rakus --- bash-4.2/lib/sh/strtrans.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/bash-4.2/lib/sh/strtrans.c b/bash-4.2/lib/sh/strtrans.c index 57f9af0..a31b

Re: Syntax Question...

2011-08-16 Thread Greg Wooledge
On Mon, Aug 15, 2011 at 08:19:01PM -0700, Linda Walsh wrote: > ` Dennis Williamson wrote: > >As has been said before, don't use "bash -e". >Why don't you convince Chet to remove it then? He can't, because people like you keep using it. Also, it's probably mandated by POSIX. I can't be bothe

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
` Dennis Williamson wrote: Also, it's usually not necessary to maintain an index variable and use shift in a while loop. Use "for arg; do" which uses an implied $@. I tried to implement your suggestion and quickly ran into the reasons why I did what I did. Using the 'for x;