Created
December 21, 2018 00:04
-
-
Save arthurcvm/326f8c4a4864751e5dbc47cca6983965 to your computer and use it in GitHub Desktop.
Script que recebe uma lista de parâmetros e o usuário escolhe um deles para que o script o imprima.
This file contains hidden or 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
#!/bin/bash | |
echo Foram digitados $# parâmetros. São eles: $*. | |
i=1 | |
while [ $i -le $# ]; do | |
variavel=${i} | |
echo $i '-' ${!variavel} | |
((i++)) | |
done | |
echo 'Escolha um dos parâmetros:' | |
read escolha | |
i=1 | |
for valor in $*; do | |
if [ $i -eq $escolha ]; then | |
echo $valor | |
fi | |
((i++)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment