I would like to pass a JSON-style vector as an argument to a script.
Example:
#!/bin/bash
vetor[]=$1
echo ${vetor[*]}
i=0
for nomes in ${vetor[*]}
do
i=$(($i+1))
echo "Nome $i é $nomes"
done
And I would like to do this:
> bash MeuScript.sh [" Joao", "Jose", "Carlos"]
Is there any way to do this? For I have to pass this structure as an argument and this vector has to be interpreted as a single argument.