dimanche 18 janvier 2015

Assign specific line from a variable to another variable


I would like to take a specific line from a variable to anther variable. I tried this but it doesn't work:



c="1.apple
2.banna
3.peach"

read "Please choose fruit [1-3]:" t

a=$c | awk "NR==$t"
echo "You choose: $a"


What is my mistake?



Aucun commentaire:

Enregistrer un commentaire