Question: Below is my code and then the screen shots when running my code, not sure what i did wrong and why i am getting theses
Below is my code and then the screen shots when running my code, not sure what i did wrong and why i am getting theses errors can someone please help thank you. The very last few screen shots is the guide lines to the assignment. THANK YOU!
proj1.bash #!/bin/bash
#echos the menu of commands
echo "Enter one of the following actions or press CTRL-D to exit"
echo "C - create a customer file"
echo "P - accept a customer file"
echo "F - find customer by apartment number"
#starts the loop
while read -p "Input Command: " input
do
#reads through the input
case "$input" in
[Cc])
#creates the customer
bash create.bash
;;
[Pp])
#pays the customer
read -p "Enter the customer email: " recCustEmail
read -p "Enter the ammount you want to transfer: " transAmmnt
count=0
#checks to see if the customer exists
for fn in $(grep -r -l "$recCustEmail" Data);do
count=$(($count+1))
done
if [ $count -eq 0 ]
then
echo "Error: customer does not exist"
else
bash pay.bash $transAmmnt
fi
;;
[Ff])
#Finds the customer at an appartment
read -p "Enter the Apartment Number: " aptNum
count=0
#checks to see if the customer exists
for fn in $(grep -r -l "$aptNum" Data);do
bash find.bash
count=$(($count+1))
done
if [ $count -eq 0 ]
then
echo "Error: apartment number not found"
fi
;;
*)
#defaults to error invalid action value
echo "Error: invalid action value"
;;
esac
done Create.bash read -p "Enter your new customer email: " custEmail
read -p "Enter the customer's full name: " custFirstName custLastName
read -p "Enter the apartment number: " apptNum
read -p "Enter the monthly rent: " rentAmnt
read -p "Enter the next due date: " rentDueDt
accBal=0
count=0
#checks to see if customer exists
for fn in $(grep -r -l "$custEmail" Data);do
count=$(($count+1))
done
if [ $count -eq 0 ]
then
#creates the file
{
echo "$custEmail $custFirstName $custLastName"
echo "$apptNum $accBal $rentAmnt $rentDueDt"
}>"Data/$custEmail"
else
echo "Error: customer already exists"
fi find.bash read custEmail custFirstName custLastName
read aptNum bal rate dueDate
echo "Email: $custEmail"
echo "Name: $custFirstName $custLastName"
echo "Apt: $aptNum"
echo "Balance: $bal"
echo "Rent Amnt: $rate"
echo "Due Date: $dueDate" pay.bash read email fName lName
read aptNum bal rate dDate
bal=$(($bal+$1))
{
echo "$email $fName $lName"
echo "$aptNum $bal $rate $dDate"
}>"Data/$email"








fox01:/courses/cs3423/assigni> ./proji.bash Enter one of the following actions or press CTRL-D to exit. C - create a customer file P accept a customer file Ffind customer by apartment number Input Command: C Enter your new customer email: Enter the customer's full name: Enter the apartment number: Enter the monthly rent: Enter the next due date: Create . bash : line 10: 3yntax error near unexpected token in$ (grep-r-1 "4custE mail" Data) ' Create .bash : line 10: for fn in$ (grep-r -1 "4custEmail" Data);do Input Command
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
