Shell tips and tricks

Ben Scott dragonhawk at gmail.com
Wed Oct 31 23:17:48 EDT 2007


On 10/31/07, Steven W. Orr <steveo at syslang.net> wrote:
> 1. The area of *proper* bash initialization. How people set up their init
> files is an area of universal shame.

  I can publish my over-complicated, over-engineered set of
initialization files if you like.  The way I have it set up,
~/.bash_profile and ~/.bashrc are just control scripts which look for
files (by extension) under ~/.shell.d/ and source them.  I did this
because I was finding myself bouncing around between very different
systems, and not all of them had the same software or versions, and I
wanted different things depending on the system.  For example, I can
just scp "mplayer.brc" into ~/shell.d/ and get a bunch of convenience
aliases for mplayer -- but I don't do that on remote servers I only
SSH into.

> 2. How to write scripts that do what the shell is capable of with (more)
> minimal callouts to external programs.

  Seeing more on this would be good.  I'm not as good at this as I could be.

> Given (let's say) 5 lines of output from p1, what will it print?

  The thing that still confuses me about that particular pitfall is
that if you're not calling out to external programs, it doesn't
happen.  But other places in the shell don't magically create new
subshells just because you're invoking an external program.  Is there
a reason behind this behavior, or is it "just one of those things"?

-- Ben


More information about the gnhlug-discuss mailing list