Created
July 12, 2014 17:08
-
-
Save elmijo/9381bbe88af04f6e8f99 to your computer and use it in GitHub Desktop.
Función bash que permite convertir los parametros de pasados a un script en variables ( bash script function to convert arguments to variables )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
argumentsToVar(){ | |
for var in "$@" | |
do | |
varname=`echo "$var"|cut -d'=' -f 1 | cut -c 3-` | |
varname=${varname//-/} | |
eval ${varname}=`echo "$var"|cut -d'=' -f 2` | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Arguments to Variables
Permite convertir los parámetros que pasamos a un archivo script en variables de forma dinámica.
Ejemplo:
script.sh