Created
July 22, 2009 09:28
-
-
Save hc5duke/151901 to your computer and use it in GitHub Desktop.
copied visnup and alc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# based heavily on termwide prompt by Giles - created 2 November 98 | |
# http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-12.html | |
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/Users/hchoi/dev/android-sdk-mac_x86-1.1_r1/tools:$PATH | |
export DISPLAY=:0.0 | |
export EDITOR=vi | |
function prompt_command { | |
local fillsize | |
local cut | |
PS_PWD="${PWD/$HOME/~}" | |
local promptsize=$(echo -n "[${USER}@$(hostname -s) 00:00:00] " \ | |
| wc -c | tr -d " ") | |
let fillsize=${COLUMNS}-${promptsize} | |
PS_FILL="" | |
while [ "$fillsize" -gt "0" ] | |
do | |
PS_FILL="${PS_FILL}―" | |
let fillsize=${fillsize}-1 | |
done | |
if [ "$fillsize" -lt "0" ] | |
then | |
let cut=3-${fillsize} | |
PS_PWD="...$(echo -n $PS_PWD | sed -e "s/\(^.\{$cut\}\)\(.*\)/\2/")" | |
fi | |
} | |
PROMPT_COMMAND=prompt_command | |
function termwide { | |
local BLUE="\[\033[1;34m\]" | |
local GRAY="\[\033[1;30m\]" | |
local NO_COLOUR="\[\033[0m\]" | |
case $TERM in | |
xterm*) | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
PS1="$TITLEBAR\ | |
$GRAY[\u@\h \${PS_FILL} \t]\n\ | |
$BLUE[\${PS_PWD}] $NO_COLOUR\$ " | |
PS2=">$NO_COLOUR " | |
} | |
termwide |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment