#!/bin/bash IFS=$'\t' case "$1" in "-T" ) echo is it -T total=0 while read ID description manufacurer price quantity do if [ $ID == $2 ]; then echo $price $quantity total=$((price*quantity)) fi done <"products.txt" echo Total value of $discription is $total ;; "-n" ) echo it is -n while read name ID date do if [ $name == $2 ]; then while read PID description manufacturer price quantity do if [ $PID == $ID ]; then echo $name bought $description and its price is $price fi done<"products.txt" fi done <"names.txt" ;; "-N") total=0 while read Name ID Date do if [ $Name == $2 ]; then while read PID Desc manufacturer price inventory do if [ $ID == $PID ]; then total=$((total+price)) fi done <"products.txt" fi done <"names.txt" echo $Name spent $total ;; "-I") while read Name ID Date do if [ $ID == $2 ]; then echo -n "$Name, " fi done <"names.txt" while read ID Desc Manug price inventory do if [ $ID == $2 ]; then echo bought $Desc fi done <"products.txt" ;; *) echo somethign else ;; esac