Re: Syntax for tab character

2009-04-25 Thread Bill Gradwohl
On Sat, 2009-04-25 at 14:49 -0400, Chet Ramey wrote: > No, there really aren't any tabs in the value of ${parameter}. For > some reason, you use `echo -e' to send input to `dumpit'. The whole > reason the -e option to echo exists is to expand backslash escapes, > and it dutifully expands \t to ta

Re: Syntax for tab character

2009-04-25 Thread Chet Ramey
Bill Gradwohl wrote: > On Fri, 2009-04-24 at 18:54 -0400, Chet Ramey wrote: >> I'm not quite sure what this is supposed to demonstrate. In the cases >> where you have specified the tab character correctly ($'\t'), it's >> converted into a tab before matching is attempted. > I respectfully disagr

Re: Syntax for tab character

2009-04-25 Thread Andreas Schwab
Bill Gradwohl writes: > And I also used printf as you suggested, and they both produce the same > output. No, they don't. 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: Syntax for tab character

2009-04-25 Thread Bill Gradwohl
On Sat, 2009-04-25 at 15:22 +0200, Andreas Schwab wrote: > You *still* use echo -e! And I also used printf as you suggested, and they both produce the same output. What's the problem? -- Bill Gradwohl signature.asc Description: This is a digitally signed message part

Re: Syntax for tab character

2009-04-25 Thread Andreas Schwab
Bill Gradwohl writes: > Please run the script and see for yourself. You *still* use echo -e! 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: Syntax for tab character

2009-04-25 Thread Bill Gradwohl
On Sat, 2009-04-25 at 14:17 +0200, Andreas Schwab wrote: > Your hex dump proves nothing. Your use of `echo -e' mangles the value. > Only `printf %s' can output the literal value of its argument. The fixed script augmented with printf is attached. They both produce the same results, so printf or e

Re: Syntax for tab character

2009-04-25 Thread Andreas Schwab
Bill Gradwohl writes: > I did a hex dump to prove Your hex dump proves nothing. Your use of `echo -e' mangles the value. Only `printf %s' can output the literal value of its argument. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5

Re: Syntax for tab character

2009-04-25 Thread Bill Gradwohl
On Fri, 2009-04-24 at 18:54 -0400, Chet Ramey wrote: > I'm not quite sure what this is supposed to demonstrate. In the cases > where you have specified the tab character correctly ($'\t'), it's > converted into a tab before matching is attempted. I respectfully disagree, and I believe I have pro

Re: Syntax for tab character

2009-04-24 Thread Chet Ramey
Bill Gradwohl wrote: > On Fri, 2009-04-24 at 13:50 -0400, Greg Wooledge wrote: >> parameter=${parameter//[[:space:]]/} > I never saw that before. I checked my man bash for version bash-3.2-30 > from Fedora 10 and there is no mention of it. Thanks. Look at the description of character classes in th

Re: Syntax for tab character

2009-04-24 Thread Chet Ramey
Bill Gradwohl wrote: > On Fri, 2009-04-24 at 13:50 -0400, Greg Wooledge wrote: >> parameter=${paramter//[ $'\t']/} > > I experimented a bit. See the attachment. > > > The first 3 dumpit outputs are expected. The next 2 are not. The last 2 > show what I would have expected from the previous 2. I

Re: Syntax for tab character

2009-04-24 Thread Andreas Schwab
Bill Gradwohl writes: > The $' inside the [] is being used up but not in any way I expected. > Clearly, $'\t' is not representing a tab character, nor is it just using > the $ as a character in its own right. What is it doing? Since $parameter does not contain any tab characters there is no tab

Re: Syntax for tab character

2009-04-24 Thread Bill Gradwohl
On Fri, 2009-04-24 at 13:50 -0400, Greg Wooledge wrote: > parameter=${paramter//[ $'\t']/} I experimented a bit. See the attachment. The first 3 dumpit outputs are expected. The next 2 are not. The last 2 show what I would have expected from the previous 2. The $' inside the [] is being used up

Re: Syntax for tab character

2009-04-24 Thread Bill Gradwohl
On Fri, 2009-04-24 at 13:50 -0400, Greg Wooledge wrote: > parameter=${parameter//[[:space:]]/} I never saw that before. I checked my man bash for version bash-3.2-30 from Fedora 10 and there is no mention of it. Thanks. > > or > > parameter=${paramter//[ $'\t']/} I tried all the variations except

Re: Syntax for tab character

2009-04-24 Thread Chet Ramey
Greg Wooledge wrote: > From an older bash(1) manual: > >Words of the form $'string' are treated specially. The word expands to >string, with backslash-escaped characters replaced as specifed by the >ANSI C standard. > > Bash 4 manual: > > Words of the form $st

Re: Syntax for tab character

2009-04-24 Thread Greg Wooledge
On Fri, Apr 24, 2009 at 11:32:09AM -0600, Bill Gradwohl wrote: > What I want to do is remove all the space and tab characters. parameter=${parameter//[[:space:]]/} or parameter=${paramter//[ $'\t']/} >From an older bash(1) manual: Words of the form $'string' are treated specially. The