Blog de Javier Castañón – JavCastaPosts RSS Comments RSS

#!/bin/bash

# Habilitar debugger con #!/bin/bash +x
# ejercicio tema 12 script registro logs (menu simple)
# Alumno: Javier Castañón Curso: Linux Básico San Valero
# 25-08-2009
#
#

clear
cd
# sino existe creamos una carpeta registro en nuestro directorio

if ! [ -d $HOME/registro ]; then
mkdir $HOME/registro
fi
CAMINO=$HOME/registro
echo > $CAMINO/who_w_finger.txt
function muestra {
echo
echo “Contenido de $CAMINO/who_w_finger.txt”
cat $CAMINO/who_w_finger.txt
echo
}

echo ‘Control de logs’
echo ‘===============’
echo
cd
echo ‘Elige el comando a ejecutarse: who, w ,finger)’
OPTIONS=“who w finger salir”
select opt in $OPTIONS; do
if [ "$opt" = "who" ]; then
clear
echo ‘has elegido who’
who > $CAMINO/who.txt
who >> $CAMINO/who_w_finger.txt
echo ‘resultado de who’
cat $CAMINO/who.txt
muestra
elif [ "$opt" = "w" ]; then
clear
echo ‘has elegido w’
w > $CAMINO/w.txt
w >> $CAMINO/who_w_finger.txt
echo ‘resultado de w’
cat $CAMINO/w.txt
muestra
elif [ "$opt" = "finger" ]; then
clear
echo ‘has elegido finger’
finger > $CAMINO/finger.txt
finger >> $CAMINO/who_w_finger.txt
echo ‘resultado de finger’
cat $CAMINO/finger.txt
muestra
elif [ "$opt" = "salir" ]; then
exit
else
clear
echo Opción incorrecta
fi
done

  • Share/Bookmark
Clika en el altavoz para oir el postAltavoz

Necesito trabajo, si tienes una propuesta de trabajo mail-me to: trabajo.job@javcasta.com

Soy técnico de sistemas, comunicaciones y soporte informático. (CV online). Formación

– realizo scripts por encargo. ver CustomScript


Leave a Reply

Los enlaces en los comentarios pueden encontrarse libres de nofollow.

Powered by WP Hashcash

?>