[wellylug] Take a hint

David Antliff dave.antliff at paradise.net.nz
Tue Sep 7 10:43:32 NZST 2004


I learned a lot from this at one stage:

http://www.deadman.org/bash.html

It explains all those weird bash constructs like !!:p, !N, !*, ^x^y etc.

Also, speaking of Ian Caliban - install and use his bash-completion
script. It's fantastic. It extends bash's tab-completion over remote
protocols (ssh, scp, rsync, etc) as well as host names, CVS, and even many
popular programs' command lines. My favourite is ./configure --[TAB]
with COMP_CONFIGURE_HINTS=1 :)

$ COMP_CONFIGURE_HINTS=1
$ source /etc/bash_completion
$ ./configure --[TAB]
--bindir=DIR                       --oldincludedir=DIR
--build=BUILD                      --prefix=PREFIX
--cache-file=FILE                  --program-prefix=PREFIX
--datadir=DIR                      --program-suffix=SUFFIX
--disable-FEATURE                  --program-transform-name=PROGRAM
--disable-internet-domain-sockets  --quiet
--disable-sysv-ipc                 --sbindir=DIR
--disable-unix-domain-sockets      --sharedstatedir=DIR
--disable-xauth                    --silent
--enable-FEATURE                   --srcdir=DIR
--enable-xauth                     --sysconfdir=DIR
--exec-prefix=EPREFIX              --target=TARGET
--help                             --version
--host=HOST                        --with-PACKAGE
--includedir=DIR                   --with-resolv
--infodir=DIR                      --with-x
--libdir=DIR                       --without-PACKAGE
--libexecdir=DIR                   --without-resolv
--localstatedir=DIR                --x-includes=DIR
--mandir=DIR                       --x-libraries=DIR
--no-create


Gentoo users can simply emerge app-shells/bash-completion


Another hint for bash-completion - change your PATH to include root's bin
directories BEFORE sourcing the script, then restore your PATH afterwards.
This allows the script to pick up the existence of programs in /usr/sbin,
/sbin, etc. Here's how I load it in my .bashrc:

  OLD_PATH=${PATH}
  PATH=/usr/local/bin:/bin:/usr/bin:/usr/bin/X11:/sbin:/usr/sbin:/usr/local/sbin
  COMP_CONFIGURE_HINTS=1
  source /etc/bash_completion
  export PATH=${OLD_PATH}

You don't need to do this if you use a 'complete' PATH normally, just make
sure it's all set up before sourcing the bash-completion script.

-- 
David.





More information about the wellylug mailing list