On Mon, Jul 31, 2000 at 11:58:46PM -0400, Mike A. Harris wrote:
> On Mon, 31 Jul 2000 [EMAIL PROTECTED] wrote:
> 
> The big space is a literal tab character that I entered by
> pressing CTRL-V TAB.  When I use this, it works
> perfectly.  However, such code is very unreadable and
> confusing.  I tried replacing the hard TAB character with "\t",
> "\011", all to no avail.  Any other idea?
> 
> echo -e ${zz%%\t*}:${zz##*\t}

I tried this variation myself, with the same results. I didn't know
about the Ctrl+V thing, though -- that's interesting.

Yes, it's really ugly code and nearly unreadable, but if you use a
better variable name than my nasty 'zz' that will help and so perhaps might
a comment apologizing :-) and explaining to the maintainer what's
going on. I'm no bash guru, so I can't come up with better.

Say, isn't there a comp.shells newsgroup? I think there is. Whatever
the name of the group, I know that the author of bash reads it. He or
someone else on that ng might be able to offer a better clue than I.

> 
> >The '%%' deletes everything that matches the pattern (in this case, a
> >space followed by anything) from the end of the variable's value.
> >
> >The '##' does the opposite: deletes anything (followed by a space)
> >from the beginning of the variable's value.
> 
> Wow.  You just explained it in a way that makes total sense, and
> in about 1/3 the words used in the cryptic bash manpage.  I read
> and reread the manpage several times and had no idea what it was
> meaning, and I'm pretty good with technical reading...
> 
> Perhaps you should maintain the bash manpage.  ;o)

Credit where credit is due: those little explanations were paraphrases
of material in O'Reilly's bash book (with the bass :-). The book's
examples were more useful in understanding what these structures
do than the explanations were, though.

Unsolicited review: I was disappointed with the bass book. I found it
to be less clear than the average ORA book and too short. Its
principle value to me has been as a reference for what I'll call (for
lack of a better word) all the bash goodies; it is extremely useful
for this purpose IMO.

Fred

-- 
"The philosophy that everyone started to put forth was 'Write programs that do
one thing and do it well. Write programs to work together. Write programs that
handle text streams, because that is a universal interface.'" -- Bell Labs, the
Creation of the UNIX Operating System



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to