Cobol Foro

Cobol Foro (https://www.cobolforo.es/index.php)
-   Sistemas operativos (https://www.cobolforo.es/forumdisplay.php?f=60)
-   -   Colorear ls en AIX con AWK (https://www.cobolforo.es/showthread.php?t=899)

Kuk 4 de octubre de 2018 17:09

Colorear ls en AIX con AWK
 
Código Bash:
  1. #!/bin/bash
  2.  
  3. ls -l "$@" | awk 'BEGIN {ORS="\n";FS=" "}
  4.  
  5. {
  6. if ($0 ~ /^d/) print "\033[1;34m" $0 "\033[0m";
  7. else
  8. if ($0 ~ /^l/) print "\033[1;31m" $0 "\033[0m";
  9. else
  10. if ($0 ~ /^c/ || $0 ~ /^b/) print "\033[44;37m" $0 "\033[0m";
  11. else
  12. if ($0 ~ /^s/) print "\033[0;31m" $0 "\033[0m";
  13. else
  14. if (substr($0,4,1) == "x" || substr($0,7,1) == "x" || substr($0,10,1) == "x")
  15. {print substr($0,1,58) "\033[1;32m"  $9 "\033[0m";}
  16. else
  17. print "\033[0m" $0 ;
  18. }'


La franja horaria es GMT +2. Ahora son las 13:06.

Powered by: vBulletin, Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.