BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] What the use of .bashrc
- Subject: [Discuss] What the use of .bashrc
- From: gaf at blu.org (Jerry Feldman)
- Date: Wed, 31 Oct 2012 11:20:32 -0400
- In-reply-to: <332CDC02-59FF-4322-9EE6-E857076FA44B@gapps.blu.org>
- References: <1351609109.v2.mailanyonewebmail-496295@fuseweb2f> <508FED34.3090706@blu.org> <CAFv2jcatMnWTJFC7JioF2_EPH+LVovNrmF31VfLTHXtSHcwHYg@mail.gmail.com> <508FFB7B.20905@blu.org> <34663AF8-16D1-4476-916A-64AF22E98BD7@polcari.com> <332CDC02-59FF-4322-9EE6-E857076FA44B@gapps.blu.org>
Note that it was not my sleight of hand. The pathmunge() function occurs in /etc/bashrc and in /etc/profile. I generally have become very knowledgeable on both expressions and variable substitutions and pattern matching since I have had to write a fairly extensive script application (updated to use TCL). But, even way back in Digital days I've had to write some fairly complex scripts, or at least debug them. It used to drive me crazy when a standard would change the behavior of a script that had been working for years. On 10/31/2012 08:28 AM, John Abreau wrote: > It was just a simple oversight on my part. I failed to notice that the case statement > wrapped $PATH in colons, and as a result I mistakenly thought Jerry was claiming > that bash exhibits a magical and non-intuitive special case for globbing on the PATH > variable. But it wasn't a magical special case, just a bit of sleight-of-hand at the start. > > > > Sent from my iPad > > On Oct 31, 2012, at 8:12 AM, Joe Polcari <joe at polcari.com> wrote: > >> If bash can do it, it's in this guide, my bash bible: >> http://www.tldp.org/LDP/abs/abs-guide.pdf >> >> >> >> >> >> Sent from my iPad >> >> On Oct 30, 2012, at 12:08 PM, Jerry Feldman <gaf at blu.org> wrote: >> >>> I generally use "Learning the BASH Shell" as a reference, but here is >>> the definition: >>> http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion >>> >>> >>> >>> On 10/30/2012 11:46 AM, John Abreau wrote: >>>> I just looked for that in the bash manpage, and i can't find anything >>>> describing >>>> that behavior. Can you highlight where you discovered that? >>>> >>>> >>>> >>>> On Tue, Oct 30, 2012 at 11:07 AM, Jerry Feldman <gaf at blu.org> wrote: >>>>> On 10/30/2012 10:58 AM, joe at polcari.com wrote: >>>>>> Looks to me like the first test only tests if $1 is not at the end of $PATHor am I missing something? ----- Original Message -----From: "Jerry Feldman" >;gaf at blu.org >>>>>> >>>>> No, it tests is $1 exists in $PATH. >>>>> I really hate bash pattern matching because I have to read the manual >>>>> every time I use them. >>>>> in this case '*:"$1":*' looks for $1 anywhere in $PATH. >>>> >>> Look at expressions. A path is delimited by colons. So, this means look >>> for $1 anywhere in a path. You can easily test it. I have not looked at >>> some of the boundary cases, but they appear to work since I've been >>> using this for years. >>> >>> case ":${PATH}:" in >>> *:"$1":*) >>> ;; >>> Note that $PATH is prepended and appended by ':'. So, assume a PATH is >>> $HOME/bin/usr/bin, the pattern is ":$HOME/bin:/usr/bin:" >>> So, it will look for $1 anywhere between 2 colons. >>> http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion >>> >>> >>> -- >>> Jerry Feldman <gaf at blu.org> >>> Boston Linux and Unix >>> PGP key id:3BC1EB90 >>> PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90 >>> >>> >>> _______________________________________________ >>> Discuss mailing list >>> Discuss at blu.org >>> http://lists.blu.org/mailman/listinfo/discuss >> _______________________________________________ >> Discuss mailing list >> Discuss at blu.org >> http://lists.blu.org/mailman/listinfo/discuss -- Jerry Feldman <gaf at blu.org> Boston Linux and Unix PGP key id:3BC1EB90 PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90
- References:
- [Discuss] What the use of .bashrc
- From: joe at polcari.com (joe at polcari.com)
- [Discuss] What the use of .bashrc
- From: gaf at blu.org (Jerry Feldman)
- [Discuss] What the use of .bashrc
- From: abreauj at gmail.com (John Abreau)
- [Discuss] What the use of .bashrc
- From: gaf at blu.org (Jerry Feldman)
- [Discuss] What the use of .bashrc
- From: joe at polcari.com (Joe Polcari)
- [Discuss] What the use of .bashrc
- From: jabr at gapps.blu.org (John Abreau)
- [Discuss] What the use of .bashrc
- Prev by Date: [Discuss] What the use of .bashrc
- Next by Date: [Discuss] TrueCrypt on a network Drive
- Previous by thread: [Discuss] What the use of .bashrc
- Next by thread: [Discuss] What the use of .bashrc
- Index(es):