
Genial este prompt que simplificara bastante la separacion del output por pantalla cuando ejecutemos varios comandos. Para usarlo creamos el fichero “.bash_ps1? en nuestro directorio home, con el siguiente contenido:
03 |
# (this is recalculated every time the prompt is shown in function prompt_command): |
06 |
reset_style=’\[\033[00m\]‘ |
08 |
status_style=$reset_style’\[\033[0;90m\]‘ # grey color; use 0;37m for lighter color |
10 |
prompt_style=$reset_style |
12 |
command_style=$reset_style’\[\033[1;29m\]‘ # bold black |
16 |
PS1=”$status_style”‘$fill \t\n’”$prompt_style”‘${debian_chroot:+($debian_chroot)}\u@\h:\w\$’”$command_style ” |
18 |
# Reset colour for command output |
20 |
# (this one is invoked every time before a command is executed): |
22 |
trap ‘echo -ne “\e[0m"' DEBUG |
24 |
function prompt_command { |
26 |
# create a $fill of all screen width minus the time string and a space: |
28 |
let fillsize=${COLUMNS}-9 |
32 |
while [ "$fillsize" -gt "0" ] |
36 |
fill=”-${fill}” # fill with underscores to work on |
38 |
let fillsize=${fillsize}-1 |
42 |
# If this is an xterm set the title to user@host:dir |
48 |
bname=`basename “${PWD/$HOME/~}”` |
50 |
echo -ne “\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007? |
62 |
PROMPT_COMMAND=prompt_command |
O lo descargamos desde aqui. Ahora añadimos al fichero ~/.bashrc lo siguiente:
1 |
if [ -f "$HOME/.bash_ps1" ]; then |
Fuente: LifeHacker | Usemos Linux | ubuntulife