1
I would like to pass a JSON-style vector as an argument for 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 perform so :
> bash MeuScript.sh [" Joao", "Jose", "Carlos"]
Is there any way to do this ? Because I have to pass this structure as an argument and this vector has to be interpreted as a single argument.