Warning: Undefined array key "action" in /home/bakers/html/entryreply.php on line 5

Warning: Undefined variable $output in /home/bakers/html/entryreply.php on line 50

Warning: Undefined array key "EntrySubject" in /home/bakers/html/entryreply.php on line 51

Warning: Undefined variable $logintext in /home/bakers/html/entryreply.php on line 97

Warning: Undefined variable $reply_name in /home/bakers/html/entryreply.php on line 103

Warning: Undefined variable $reply_email in /home/bakers/html/entryreply.php on line 104
Perturb.org - interesting technology related things from around the internet

Bash Prompt

This is my little mini script to put in /etc/bashrc to make your bash prompt colorful!

black="\033[0;30m"
red="\033[1;31m"
white="\033[1;37m"
blue="\033[0;34m"
green="\033[1;32m"
cyan="\033[1;36m"
yellow="\033[1;33m"
purple="\033[0;35m"
brown="\033[0;33m"
gray="\033[0;37m"
reset="\033[0m"

rootc=$red
userc=$cyan
hostc=$white
dirc=$yellow

if [ "$BASH" ]; then
        if [ "`id -u`" -eq 0 ]; then
                #Special prompt for root
                prompt="$rootc\u$gray@$hostc\h$dirc(\w)$reset\n:"
                PS1=$prompt
        else
                #Prompt for the rest of the users
                prompt="$userc\u$white@$hostc\h$dirc(\w)$reset\n:"
                PS1=$prompt
        fi
fi

export PATH PS1

On modern version of Fedora you can put this script in your /etc/profile.d directory

cd /etc/profile.d/ ; wget http://www.perturb.org/code/bash_prompt.sh ; cd -


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.239.50.33
To prevent spam please submit by clicking the kitten: