BASH at CFHT

Bash is installed on all Solaris, HP-UX, and older SunOS machines at CFHT. The main advantages of bash are that it is a very fast, stable, and full featured command shell. At any time, you can type the command "bash" to enter the shell. (If /usr/local/bin is not in your PATH, then you may have to type "/usr/local/bin/bash"). In bash's interactive mode, the backspace will work correctly, the arrow keys will allow you to edit previous commands, and TAB will complete partially typed commands or filenames. (See the info pages for info on changing these bindings.)

Adding/Changing Aliases

Our version of bash is set up so that it first looks at /apps/gnu/share/bash.rc (or /apps/gnu/share/bash.profile for "login" shells, but they are the same file). The system-wide bash.rc will install a few aliases for you, but you may want to add aliases or environment variables in a file in your home directory called .bashrc. Or, if you want to provide your own aliases in place of the ones in the system default, first copy the system default to your home directory with:
  cp /apps/gnu/share/bash-aliases ~/.bash-aliases
and then make any modifications you want. The system bash.rc file will use your .bash-aliases instead of the default one in /apps/gnu/share/.

If you create a .bashrc, I recommend making a symlink to it with:

  ln -s .bashrc ~/.bash_login
So that login shells will behave the same as other shells. (The distinction between login and non-login shells has been abused to the point where it is simplest to just operate them identically, in my opinion.)

PLEASE NOTE: The syntax for setting aliases is:

  alias command="command -alias ..."
Which may be different from what you are used to. If you copy alias settings used with another shell, be sure you translate them to this format!

Environment Variables

As mentioned above, you can set and/or export environment variables in your .bashrc, but it is NOT recommended to mess with the following:

TERM
This one will get set by whichever terminal emulator (Xterm, rxvt, hpterm) that the shell is running in, so you should never have to set it. When no TERM is set (which may happen if you connect from home with a Windows terminal, for example) the system-wide bash.rc will set TERM to "vt100" for you, which works for the vast majority of terminal types.

DISPLAY
If you are using FVWM, this one will always be set correctly by the session startup. To create a window on another computer, with the DISPLAY already set up automatically, use the "makehost hostname" command, or the root menus of the window manager and you should not have to set the DISPLAY.

PATH
The default path includes "." and then "$HOME/bin/". So, if you have personal stuff installed in your home directory which you want to have searched first, you don't have to change anything as long as you put the programs (or links to them) in $HOME/bin. To add other paths, rather than resetting the default PATH, the following is recommended. Let's say you wanted to add $HOME/usr/bin to your PATH. Add this to your .bashrc:
  export PATH=.:$HOME/usr/bin:$PATH
The csh syntax using "setenv" will also work. To find out where in your path a particular command is being found by bash, you can use the builtin type. For example:
> type -a ls
ls is an alias for ls -sF
ls is /bin/ls
> _

Choosing Bash as your default shell

If you would like to get "bash" by default, any time you log on or telnet/rlogin to a machine, you will have to log on to "uwila" and use the chsh command to change your default login shell. Issue the command "chsh username", where username is your login. Then enter the full path "/apps/gnu/bin/bash" and then your password. The next time you log in, you should get the bash prompt automatically:
> chsh isani
Changing NIS login shell for isani on uwila.
Old shell: /bin/csh
New shell: /apps/gnu/bin/bash
Password:
NIS entry changed on uwila
> _

Note about FTP

FTP on some machines may only accept connections for users who are using a shell that is listed in the file /etc/shells. If you are having trouble ftp-ing to a machine that does not have /apps/gnu/bin/bash listed in its /etc/shells, please ask Bob or Sidik to add it and everything should work fine.

More Information

The rest of the information in the Bash info pages will help guide you if you want to get fancier with it.
Sidik Isani