Exmaple of my information: Fruit,Quantity Red Apple,10 Green Apple,10 Orange,20
Here's my code:
if [ "$fruit != $blank" ] && [ "$quantity" == "$blank" ]; then
cut -d,: -f1 information.txt | grep $fruit
elif [ "$quantity != $blank" ] && [ "$fruit" == "$blank" ]; then
cut -d,: -f2 information.txt | grep $quantity
My code will only display the intended search, so if you key in "Apple", it will only display "Red Apple" and "Green Apple" but not the quantity, how do i make it to display all the information. Same as quantity, if you key in "20", it will only display "20".
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire