PDA

Ver la Versión Completa : Visualizando mejor los comandos que ejecutamos desde la terminal



Xripox
24/11/2011, 09:31
[Only registered and activated users can see links]

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:


# Fill with minuses

# (this is recalculated every time the prompt is shown in function prompt_command):

fill=”— ”
reset_style=’\[\033[00m\]‘

status_style=$reset_style’\[\033[0;90m\]‘ # grey color; use 0;37m for lighter color

prompt_style=$reset_style

command_style=$reset_style’\[\033[1;29m\]‘ # bold black

# Prompt variable:

[Only registered and activated users can see links]

# Reset colour for command output

# (this one is invoked every time before a command is executed):

trap ‘echo -ne “\e[0m"' DEBUG

function prompt_command {

# create a $fill of all screen width minus the time string and a space:

let fillsize=${COLUMNS}-9

fill=""

while [ "$fillsize" -gt "0" ]

do

fill=”-${fill}” # fill with underscores to work on

let fillsize=${fillsize}-1

done

[Only registered and activated users can see links]

case “$TERM” in

xterm*|rxvt*)

bname=`basename “${PWD/$HOME/~}”`

[Only registered and activated users can see links]

;;

*)

;;

esac

}

PROMPT_COMMAND=prompt_command

O lo descargamos desde aqui ([Only registered and activated users can see links]). Ahora añadimos al fichero ~/.bashrc lo siguiente:


if [ -f "$HOME/.bash_ps1" ]; then
. “$HOME/.bash_ps1″
fi



Visto en Ubuntulife ([Only registered and activated users can see links])