florin at iucha.net (Florin Iucha)  wrote:
> For interactive use I prefer pdksh (a free ksh clone) because it has
> the vi command line editor coupled with tab-based filename
> completion.

  bash$ set -o vi
  # Look!  Vi keybindings!!!
  bash$ vi bl[TAB][TAB]
  blee.txt blah.txt
  bash$ source /etc/bash_completion
  bash$ ls
  README			thissong.ogg		thatsong.ogg
  NONOGGFILE		here.mp3			there.mp3
  bash$ ogg123 [TAB][TAB]
  thissong.ogg	thatsong.ogg
  bash$ cd ~/checkout/cvs/someproject
  bash$ cvs [TAB][TAB]
  ... list of cvs commands ...

For all GNU software that links against readline library, which
includes BASH, you can customize your experience with ~/.inputrc.
Mine is relatively simple:

  # .inputrc - inputrc for libreadline
  # See readline(3readline) and `info readline' for more information.

  # Use vi mode
  set editing-mode vi

  # Be 8 bit clean.
  set input-meta on
  set output-meta on

  # To allow the use of 8bit-characters like the german umlauts, comment out
  # the line below. However this makes the meta key not work as a meta key,
  # which is annoying to those which don't need to type in 8-bit characters.

  set convert-meta off

  # Other options
  set mark-directories on
  set visible-stats on
  set mark-modified-lines on

  set horizontal-scroll-mode on

That why, I never have to type "set -o vi" or add that to my
~/.bashrc.  The bonus is that if you're using another application that
links against readline lib, you get customized keybindings for free.
lftp is my favorite command-line ftp client.  It has vi keybindings
because it uses libreadline. ;-)

There was an interesting BASH article recently that talked about
"themes".  Essentially, the author had created a way to source
different BASH scripts into his current environment using a command
"Theme <theme>".  Obviously a Mac user, but not a bad idea.  The
article is here:

http://www.onlamp.com/pub/a/onlamp/2006/02/02/bash_themes.html

Another good source for information, other than /usr/share/doc/bash,
is http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html.

Which is more powerful or easier to use?  pdksh or BASH?  I think it
all depends upon your familiarity with shells.  If you used to work on
DEC machines, you probably used ksh.  pdksh is an obvious choice.  If
you worked on Sun machines or BSD machines (9 < Mac OS <= 10.2.x),
you're probably more familiar with csh.  tcsh is an obvious choice.
If you've used Linux (or Mac OS >= 10.3.x) for most of your *NIX
experience, you'ld probably be using BASH.

For simple scripting, try to stick with POSIX sh commands.  Every *NIX
system has a POSIX compatible sh interpretor, BASH being "mostly"
POSIX if you ask it to be.  ash and dash are both minimalistic shells
that implement POSIX, period.  Even if you don't use them in every-day
terminal life, they're good to have around.  Write a script and run
"dash -n" to see if it's syntax-clean without running it.

For more complex scripting, choose Python, Perl, or even Scheme (GNU
Guile, for instance).  Python and Perl will most likely be installed
on all Linux platforms in one version or another.  GNU Guile *may* be
installed, but it wouldn't be difficult to ask someone to add it for
you.

Anyway, back to the grind.

-- 
Chad Walstrom <chewie at wookimus.net>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */