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:
01 |
# Fill with minuses |
02 |
03 |
# (this is recalculated every time the prompt is shown in function prompt_command): |
04 |
05 |
fill=”— ” |
06 |
reset_style=’\[\033[00m\]‘ |
07 |
08 |
status_style=$reset_style’\[\033[0;90m\]‘ # grey color; use 0;37m for lighter color |
09 |
10 |
prompt_style=$reset_style |
11 |
12 |
command_style=$reset_style’\[\033[1;29m\]‘ # bold black |
13 |
14 |
# Prompt variable: |
15 |
16 |
PS1=”$status_style”‘$fill \t\n’”$prompt_style”‘${debian_chroot:+($debian_chroot)}\u@\h:\w\$’”$command_style ” |
17 |
18 |
# Reset colour for command output |
19 |
20 |
# (this one is invoked every time before a command is executed): |
21 |
22 |
trap ‘echo -ne “\e[0m"' DEBUG |
23 |
24 |
function prompt_command { |
25 |
26 |
# create a $fill of all screen width minus the time string and a space: |
27 |
28 |
let fillsize=${COLUMNS}-9 |
29 |
30 |
fill="" |
31 |
32 |
while [ "$fillsize" -gt "0" ] |
33 |
34 |
do |
35 |
36 |
fill=”-${fill}” # fill with underscores to work on |
37 |
38 |
let fillsize=${fillsize}-1 |
39 |
40 |
done |
41 |
42 |
# If this is an xterm set the title to user@host:dir |
43 |
44 |
case “$TERM” in |
45 |
46 |
xterm*|rxvt*) |
47 |
48 |
bname=`basename “${PWD/$HOME/~}”` |
49 |
50 |
echo -ne “\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007? |
51 |
52 |
;; |
53 |
54 |
*) |
55 |
56 |
;; |
57 |
58 |
esac |
59 |
60 |
} |
61 |
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 |
2 |
. “$HOME/.bash_ps1? |
3 |
fi |
Fuente: LifeHacker | Usemos Linux | ubuntulife