Advertisement
Sergio_Istea

informe.sh

Sep 3rd, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. LOGS=/tmp/informe.log
  5.  
  6.  
  7. # '>' deriva hacia un fichero sobre escribiendo lineas previas
  8. # '>>' deriva hacia un fichero agregando nuevas lineas
  9. # echo "Usuario: $USER" > salida.txt
  10. # echo "Interprete: $SHELL" >> salida.txt
  11. # echo "Directorio de usaurio: $HOME" >> salida.txt
  12.  
  13. # El programa 'tee' permite imprimir en terminal y ademas deribar a un archivo
  14. # El pipe '|' redirige la salida de un comando 'STOUT' como parametro de entrada 'STDIN'
  15. # la opcion '-a' (append) del comando 'tee' añade lineas a un fichero.
  16.  
  17. echo "Usuario: $USER" | tee salida.txt
  18. echo "Interprete: $SHELL" | tee -a salida.txt
  19. echo "Directorio de usaurio: $HOME" | tee -a salida.txt
  20.  
  21.  
  22. echo "Listando directorio de usuario..."
  23. ls $HOME
  24.  
  25. echo "Listando directorio raiz..."
  26.  
  27. ls /
  28.  
  29. echo "Listando directorio tmp del usuario..."
  30. ls $HOME/tmp 2>> $LOGS | tee -a salida.txt #este directorio no existe
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement