PDA

View Full Version : [Bash/Python] Colourful shells



Wizzup?
09-14-2010, 02:40 PM
Paste this in your shell to get a colourful and dynamic shell. (Bash only, requires python to be installed)

export PS1="\[\` /usr/bin/python -c \"print ''.join(map(lambda x : '\033[%i;1m%s\033[0;0m' % (__import__('random').randint(31, 38), x), __import__('sys').argv[1]))\" '\u@\h \w $ ' \`\]"


Readable version:

export PS1="\[\` /usr/bin/python -c \"
s = '\033[%i;1m%s\033[0;0m'
out = ''
import sys
from random import randint
arg = sys.argv[1]
for i in arg:
out += s % (randint(31, 38), i)
print out\" '\u@\h \w $ ' \`\]"

Yakman
09-14-2010, 03:25 PM
*thumbs up*

noidea
11-21-2010, 05:10 AM
bump.
fixed white space
http://i.imgur.com/pPxfx.png

Wizzup?
11-21-2010, 10:53 AM
Nice... ;)

Camaro'
11-21-2010, 09:52 PM
Nice... ;)

This is awesome :)