informatica:linux:bash
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| informatica:linux:bash [2010/01/09 08:23] – creado 192.168.1.30 | informatica:linux:bash [2015/04/13 20:19] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ====== bash ====== | ====== bash ====== | ||
| + | |||
| + | |||
| + | |||
| ===== Sumar decimales ===== | ===== Sumar decimales ===== | ||
| < | < | ||
| + | # bash no entiende de tipos | ||
| a=" | a=" | ||
| b=" | b=" | ||
| - | c=`echo $a * $b | bc ` | + | c=`echo $a * $b | bc` |
| + | echo $c | ||
| </ | </ | ||
| + | |||
| + | ===== Tráfico de red (mejorar) ===== | ||
| + | |||
| + | / | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | echo " | ||
| + | </ | ||
| + | |||
| + | Falta por cambiar ' | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # OJO: requiere de / | ||
| + | |||
| + | Interfaz=" | ||
| + | Segundos=10 | ||
| + | |||
| + | Bytes_inicio=`awk -F'[: ]*' '/ | ||
| + | |||
| + | sleep $Segundos | ||
| + | |||
| + | Bytes_fin=`awk -F'[: ]*' '/ | ||
| + | |||
| + | echo " | ||
| + | echo " | ||
| + | Resta=`echo $Bytes_fin - $Bytes_inicio | bc` | ||
| + | echo " | ||
| + | # NO funciona | ||
| + | # | ||
| + | # Chapuza | ||
| + | Final=`/ | ||
| + | |||
| + | echo " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Colorear archivos ===== | ||
| + | |||
| + | 1. Instalar vim | ||
| + | |||
| + | sudo aptitude update && sudo aptitude install vim | ||
| + | |||
| + | 2. Crear archivo: | ||
| + | |||
| + | vim / | ||
| + | |||
| + | Con el siguiente contenido: | ||
| + | |||
| + | :syntax on | ||
| + | |||
| + | 3. Grabar y salir | ||
| + | |||
| + | |||
| + | ===== Colorear Línea de Comandos ===== | ||
| + | |||
| + | echo -en ' | ||
| + | |||
| + | https:// | ||
| + | |||
| + | rojo | ||
| + | echo -en ' | ||
| + | |||
| + | verde | ||
| + | echo -en ' | ||
| + | |||
| + | azul | ||
| + | echo -en ' | ||
| + | |||
| + | |||
| + | ===== Logs ===== | ||
| + | |||
| + | 09/ | ||
| + | |||
| + | Extraer la cola: | ||
| + | |||
| + | cat log_file.txt | grep " | ||
| + | |||
informatica/linux/bash.1263025407.txt.gz · Last modified: (external edit)
