Sunday, May 26, 2013

Bashrc Necessary


function _exit() # function to run upon exit of shell{     if [ -d ~/TC/.prnf ]     then echo "unlinking..." rm ~/TC/.prnf     fi     unset PROMPT_COMMAND     echo -ne "\033]2;No longer Maintaining Tunnel\007"     echo -e "\e[1;34mLogging off PHPete\e[0m"     history -c     dd if=/dev/urandom of=$HOME/.bash_history bs=50000 count=2 conv=notrunc     #spin     #echo "\n"     rm -f $HOME/.bash_history     echo -e "\e[1;34mPHPete's history file \e[1;31mwiped\e[0m" && spinstill 3     #sleep 1
}trap _exit EXIT

function tunnel() #master tunnel control{case "$1" in'open')   echo "Opening Permanent Tunnel..."   unset PROMPT_COMMAND   sh -c 'while echo -ne "\033]2;Maintaining Tunnel\007" ; do sleep 250 ; done'&;;'close')     echo "Closing Permanent Tunnel..."     unset PROMPT_COMMAND     tunnelpid=`ps aux | awk '/while echo/ && !/awk/ { print $2 }'`     echo tunnelPID is $tunnelpid     kill -TERM $tunnelpid     fg 2>/dev/null     echo -ne "\033]2;No longer Maintaining Tunnel\007";;'restart')     echo "Restarting Permanent Tunnel..."     unset PROMPT_COMMAND     tunnelpid=`ps aux | awk '/while echo/ && !/awk/ { print $2 }'`     echo tunnelPID is $tunnelpid     kill -TERM $tunnelpid 2>/dev/null     fg 2>/dev/null     echo -ne "\033]2;No longer Maintaining Tunnel\007"     echo "Tunnel Closed"     sleep 1     unset PROMPT_COMMAND     sh -c 'while echo -ne "\033]2;Maintaining Tunnel\007" ; do sleep 250 ; done'&     tunnelpid=`ps aux | awk '/while echo/ && !/awk/ { print $2 }'`     echo Tunnel Re-opened. PID is $tunnelpid;;'status')     echo "Tunnel Status:"     unset PROMPT_COMMAND     tunnelpid=`ps aux | awk '/while echo/ && !/awk/ { print $2 }'`     #echo "tunnelPID is one of the following: $tunnelpid"     ps aux | awk '/while echo/ && !/awk/ { print "tunnel pid: ",$2,"   tunnel opened: ",$9 }';;* )     echo "Invalid option"     echo "Valid options include open, close, restart, and status";;esac}

PS1="\[\e[1;34m\](\[\e[1;30m\]\T\[\e[1;34m\])\[\e[1;30m\]-\[\e[1;34m\](\[\e[1;30m\]\u\[\e[1;34m\])\[\e[1;30m\]-\[\e[1;34m\](\[\e[1;30m\]Jobs:\j\[\e[1;34m\])\[\e[1;30m\]-\[\e[1;34m\](\[\e[1;30m\]\w\[\e[1;34m\])\n\[\e[1;34m\](\[\e[1;30m\]\!\[\e[1;34m\])-\\$\[\e[0m\]"

How to customize??
Look this script u\[\e[1;34m\]) it will show your username on your terminal you can change it to your hostname example: h\[\e[1;34m\]) > "h" means Hostname :)
Here is it for screenshot



Bashrc Necessary



Load disqus comments

0 comments