OneCompiler

FA2

1627

#!/bin/bash

File containing customer data

DATA_FILE="customers.txt"

Account number to search for

search_account_no="1-90607"

Search the file for the account number

result=(grep "^search_account_no" "$DATA_FILE")

Check if a result was found

if [ -n "result"];thenecho"CustomerDetails:"echo"result" ]; then echo "Customer Details:" echo "result"
else
echo "Customer Details not available or Customer does not exist."
fi