por Miguel | Sep 3, 2018 | bash, linux
I was required to disable an specific port for an specific device. If an «X» device is connected in any port of the computer I should be able to enable/disable it at will. In our scenario the idea is to enable or disable a Genius GK100010 Numeric Pin Pad and other...
por Miguel | Jun 22, 2018 | bash, linux
Today I’ve found a nice problem to solve in stack overflow. There was this guy claiming why unix utility grep didn’t parse this file in his Linux. Long story short the file was being somehow «recognized» as binary for grep, because it had four NUL values....
por Miguel | Feb 8, 2018 | bash, linux
I’ve found two easy ways to round up «ceiling» float numbers with bash. Simply add «0.5» to your floating number and use printf: myfloating=$(echo «14.1129312938+0.5» | bc ) printf ‘%0.f’ $myfloating 15 Or use awk: $myfloating=14.1 echo «$myfloating»...
por Miguel | Jun 26, 2017 | bash
This one was easy, first create a file (hosts_ip.txt) with the IP of each server to get its /etc/hosts: 192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 192.168.0.7 Generate a private/public pair key and add the public one in authorized_keys of each server : # generate...
por Miguel | Jun 7, 2016 | bash
Hoy leí un artículo muy interesante para crear el log de la ejecución de un script en bash. Existen muchos métodos, tales como bash -x, script (utilidad) o la famosa redirección «>>».Este particularmente utiliza exec. Simplemente basta con agregar al inicio de...