The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Enhancing bash

Contributed by: Kevin Frei
This tip is valid for: Both BeOS and Haiku

By adding a few lines to /boot/home/.profile, you can extend the functionality of the bash shell in BeOS.

For instance, you can use all those freaky ANSI tags to make the terminal prettier. Paste the following block into your ~/.profile (note that this stuff also works for bash on other platforms that support ANSI color stuff, like CygWin32 for NT, etc…)

PS1='
! 33[1;36mw33[1;33m ->33[m'
PS2='! 33[1;36mmore33[1;33m ->33[m'


bind '"e[1~":beginning-of-line'
bind '"e[2~":paste-from-clipboard'
bind '"e[3~":delete-char'
bind '"e[4~":end-of-line'
bind '"e[5~":history-search-forward'
bind '"e[6~":history-search-backward'

And restart Terminal. This sets up your prompt to display the current command number (for easy !## access), followed by a nice bright blue path, plus a yellow ‘->’. The number shown at your prompt is the number of bash commands you’ve issued since you last cleared your .bash_history file. To repeat a command from the past, just type ! (exclamation point) and its number.

The bind statements make home/end/pgup/pgdn/insert/delete more useful than beeping and typing a ‘~’.

Brian D. Ruthrauff (ruthrauffb@knology.net) says:

To help make the text a little more readable by getting rid of the shadow effect on the letters, replace the 1 before the semicolon with a 0. For example:

PS1='! 33[0;34mB33[0;31me33[0;34m ->33[m'

(rather than using 1;34 for blue I use 0;34)

Posted in Terminal


(comments are closed).