...the shell is awesome! | |||||||||
|
Version 0.03: April 2008 |
|
Every modern operating system has at least one shell and some have many. Some
shells are command-line oriented, such as the GNU/Linux bash shell. Others are
graphical, like Windows Explorer or the Macintosh Finder. Some users will interact
with the shell only long enough to launch their favorite application, and then never
emerge from that until they log off. But most users spend a significant amount of
time using the shell. The more you know about your shell(s), the faster and more pro-
ductive you can be.
Whether you are a system administrator, a programmer, or an end user, there are
certainly occasions where a simple (or perhaps not so simple) shell script can save
you time and effort, or facilitate consistency and repeatability for some important
task. Even using an alias to change or shorten the name of a command you use often
can have a significant effect, as you will be able to constate in _Mammon's
.bash_alias.rc script.
The bash cookbook (OReilly.bash.Cookbook.May.2007.pdf) Classic Shell Scripting (Classic_Shell_Scripting_OReilly_2005.chm) Learning The BASH Shell (O'Reilly - Learning The BASH Shell, 3rd Edition_2005.chm)which have been massively uploaded on the web, and consult them on line.
|
Here are a couple of things that you can add to your ~/.bashrc
(which should be probably symlinked to ~/.login)
in order to make the CLI prompt more interesting.
|
Download
zipped/bash_setup.tgz and untar.
You'll find inside it:
# ------------------------------------------------------------------- # ifind : case insensitive find from the current directory function ifind () { if [ -z "$1" ] then echo Usage: ifind pattern return 1 fi find . -iname \*$*\* } # ------------------------------------------------------------------
|
Oh, one more people might be interested in:
# ------------------------------------------------------------------ %< # alt_wm: run an alternate window manager in a new XServer session. # Allows two XSessions to be run concurrently. Useful for testing # new window managers that are buggy, e.g. Beryl or E17. alt_wm () { if [ -z "$1" ] then echo Usage: alt_wm path [screen] return 1 fi SCREEN_NUM=$2 [ -z "$SCREEN_NUM" ] && SCREEN_NUM="1" xinit $1 -- :${SCREEN_NUM} } # ------------------------------------------------------------------ %<To use, Ctrl-Alt-F1, then "alt_wm `which fluxbox`" assuming you have fluxbox installed.
echo `date`and
echo 'date'. You can also assign to a variable:
TODAYDATE=`date` echo $TODAYDATE
|
The Z shell
~S~ Kane points out that the interactive zsh shell deserves a mention,
"as it makes doing most of the crap you need to do with bash more than ten times easier out of the box.
Most distros have a seperate package called zsh-completion that pretty much sets it up without any effort".
The z shell has indeed many interesting improvements (like a common command history among all running shells),
and its ability to interactively evaluate arguments is indeed dramatically powerful.
Check its documentation.
The choice of shell is one of
the most religious choices for
GNU/Linux users. If you are new to GNU/Linux just accept (and delve into)
the default shell bash, but as time goes and you get more advanced, you many want to change
shell because you really miss certain features. This said, I
would advise readers to stick to bash until they
understand it adeguately, and consider changing shell only in a second phase.