Setup of bash

Install the right version of bash

Warning
This document is not up-to-date!

A new bash is required to get rid of the Saami characters problem in Mac's. First we need to: get and install readline. Download the newest version. Move the readline directory to /tmp and install it (replace x and y with current version numbers):

ssh adminis@localhost
(asks admin password)
mv Desktop/readline-x.y tmp
cd /tmp/readline-x.y
sudo make install
    

Then, get and install bash. Download the newest version:

As admin:

mv Desktop/bash-x.y.z tmp
cd /tmp/bash-x.y.z
./configure
sudo make install
    

After that, configure Terminal to open bash-3.0 as default login shell:

Terminal(Pääte)->Settings(Asetukset) (or press Command-,). Check the second radio button and write path as: /usr/local/bin/bash

Alternatively, to enable new bash when starting bash in Terminal, do following:

sudo mv /bin/bash /bin/bash-old
sudo ln -s /usr/local/bin/bash /bin/bash
sudo mv /usr/share/man/man1/bash.1 /usr/share/man/man1/bash-old.1

The last command is for having manual pages for the new bash.

Setup environment variables

To make the programs we use behave as we would like, we'll have to setup the environment variables in bash. These variables has to be set up in the files, .bash_profile and .bashrc . .bash_profile gets read when we start Terminal.app from the dock or finder. .bashrc is read whenever we start a new shell from the commandline writing bash, or when we open a new Terminal.app window.

Example .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
FORREST_HOME=$HOME/Documents/forrest
PATH=$HOME/bin:$FORREST_HOME/bin:/usr/local/bin:$HOME/Documents/gt/script:$PATH
BASH_ENV=$HOME/.bashrc

export BASH_ENV PATH FORREST_HOME
unset USERNAME
export CVS_RSH=ssh

#Locale-definisjon

# UTF-8
#######
export LANG=no_NO.UTF-8
export LOCALE=UTF-8
export LESSCHARSET='utf-8'
    

Example .bashrc

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

#alias-tillegg
alias em="emacs -nw"
alias l="less"
alias ll="ls -l"
alias la="ls -a"
alias lt="ls -lt"
alias lS="ls -lS"
alias up="cvs -q up"
alias who="who | sort"
    

Setting up 8-bit input

Note
This is NOT needed anymore in Leopard / MacOS X 10.5.x. 8-bit input as well as full UTF-8 support is built in and working without needing additional setup - at least for new computers (old computers being upgraded is not yet tested).

To enable input and output processing of 8-bit bytes, put the following lines into the file '.inputrc' (without quotes, in your home directory) - without these instructions, bash will only operate in 7-bits, which is not sufficient for UTF-8 (it's an 8-bit encoding!):

# Enable 8bit input
set meta-flag on
set input-meta on

# Turns off 8th bit stripping
set convert-meta off

# Keep the 8th bit for display
set output-meta on

# Will display all alternatives for completion after one tab keypress
set show-all-if-ambiguous On
      

[the last command has nothing to do with 8-bit processing, but is a great timesaver compared to the default behaviour]

Last modified: $Date: 2011-07-04 12:28:49 +0200 (Mon, 04 Jul 2011) $, by $Author: trond $

by Tomi Pieski, Sjur Moshagen, Børre Gaup