Archive > Tag: bash

Comparación de strings en Bash

Hoy se me ocurrió que estaría chido mostrar como se hace una comparación de strings en Bash pero de forma práctica; dado que, en Bash, tendemos a ser muy estructurados y, a veces, poco eficientes.

Supongamos que quieres ver si una variable es alguna de 5 opociones. Quieres comparar el …


HowTo: Ask questions in Bash?

I've been writing some script to configure some firewall and came up with this way of asking a question in Bash. I hope it helps as an example. Feel free to contribute your own:

#!/usr/bin/env bash

ask() {
    local query=$1

    if ( echo $query | grep -qi password ); then
        read …

HowTo: Wait for any process to finish on Bash

Well, here's a quick one.

Let's say you're creating a KVM/Qemu guest; using oz-install; and you're tired, 'cause it's 06:31 and you need some sleep.

You don't want to wait the 2k seconds it takes to do all the work so you want to setup a bash script …