Re: [Discuss] What the use of .bashrc

2012-10-31 Thread Joe Polcari
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 g...@blu.org wrote: I generally use Learning the BASH Shell as a reference, but here is the definition:

Re: [Discuss] What the use of .bashrc

2012-10-31 Thread John Abreau
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

Re: [Discuss] What the use of .bashrc

2012-10-31 Thread Edward Ned Harvey (blu)
From: discuss-bounces+blu=nedharvey@blu.org [mailto:discuss- bounces+blu=nedharvey@blu.org] On Behalf Of Glenn Hoffman I'm teaching an Introduction to Linux/Unix class at UMass/Boston. I've just told the class about the different type of shells (login, interactive non-login in,

[Discuss] What the use of .bashrc

2012-10-30 Thread Glenn Hoffman
I'm teaching an Introduction to Linux/Unix class at UMass/Boston. I've just told the class about the different type of shells (login, interactive non-login in, non-interactive) and the startup files for each. I've never been able to give a class a good reason for the existence of .bashrc, since

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Jerry Feldman
On 10/30/2012 07:50 AM, Glenn Hoffman wrote: I'm teaching an Introduction to Linux/Unix class at UMass/Boston. I've just told the class about the different type of shells (login, interactive non-login in, non-interactive) and the startup files for each. I've never been able to give a class

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Rich Pieri
On Tue, 30 Oct 2012 07:50:48 -0400 Glenn Hoffman glennhoff...@mac.com wrote: existence of .bashrc, since I have never used it myself. What's the reason for a separate startup file for a non-login interactive shell? As a matter of principle, an interactive session should have one and only one

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Jerry Feldman
On 10/30/2012 10:31 AM, Chris Tyler wrote: On Tue, 2012-10-30 at 07:50 -0400, Glenn Hoffman wrote: I'm teaching an Introduction to Linux/Unix class at UMass/Boston. I've just told the class about the different type of shells (login, interactive non-login in, non-interactive) and the startup

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread j...@polcari.com
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: quot;Jerry Feldmanquot; ;g...@blu.org ___ Discuss mailing list Discuss@blu.org

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Jerry Feldman
On 10/30/2012 10:58 AM, j...@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: quot;Jerry Feldmanquot; ;g...@blu.org No, it tests is $1 exists in $PATH. I really hate bash pattern

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
One thing I used to find annoying is when an upgrade would wipe out my .bashrc. Long ago I created a .bash.d directory, within which I split up my .bashrc into separate files for easier maintenance. So my ~/.bashrc is a one-liner: source ~/.bash.d/bashrc and ~/.bash.d/bashrc is a set of

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
Interesting. I had written my own, ages ago, but I made them two separate functions. Also, they work not only for PATH, but for any similar environment variable such as MANPATH, CLASSPATH, etc. I never made them check for a pre-existing instance, though; they were simple one-liners. Thanks for

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
Oops, should have tested first. $1 should have been $2. On Tue, Oct 30, 2012 at 11:29 AM, John Abreau abre...@gmail.com wrote: Interesting. I had written my own, ages ago, but I made them two separate functions. Also, they work not only for PATH, but for any similar environment variable such

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
Good catch. Need to add 2 additional cases. On Tue, Oct 30, 2012 at 10:58 AM, j...@polcari.com j...@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: quot;Jerry Feldmanquot;

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Jerry Feldman
The big win with pathmunge() is that it does check. Every time you run a command in Linux (or Unix), your $PATH is checked until the command is found. The order of things in the path is also important. First, NEVER have dot (.) in your path. That is a very big security risk. Usually you want

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
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 g...@blu.org wrote: On 10/30/2012 10:58 AM, j...@polcari.com wrote: Looks to me like the first test

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Jerry Feldman
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

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread John Abreau
On Tue, Oct 30, 2012 at 12:08 PM, Jerry Feldman g...@blu.org wrote: case :${PATH}: in *:$1:*) ;; Note that $PATH is prepended and appended by ':'. So, assume a PATH is Ah, I see now. I didn't look closely enough to notice the extra colons in the first line; my brain

Re: [Discuss] What the use of .bashrc

2012-10-30 Thread Steve Harris
From: John Abreau abre...@gmail.com To: Jerry Feldman g...@blu.org Cc: discuss@blu.org Subject: Re: [Discuss] What the use of .bashrc Message-ID: cafv2jcatmnwtjfc7jiof2_eph+lvovnrmf31vflthxtshcw...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 I just looked