Hi guys,
I'm now trying to write a script which amends a specified field in a line and replace that old text with a newly specified one. The code is incomplete but I have the following:
Code:
#!/bin/bash
echo "######################### Amend Record ########################"
echo
echo "Please enter the username of the record you wish to amend"
read username
if grep $username information_file
then
echo "Which field of user would you like amended?"
echo
echo "1) Username"
echo "2) Address"
echo "3) E-mail address"
echo "4) Telephone extension number"
echo "5) Manager username"
echo "6) Start date"
echo "7) End date"
read option
case $option in
1) echo "Please enter new username you wish to replace old"
read new_username
`sed 's/$username/$new_username/ information_file`
;;
esac
else
echo "Username is not found in Information File! Now closing"
exit 1
fi
For now, I have an EOF error occurring somewhere in the Case statement and would like to know what it is I'm doing wrong. Hope you can help. Thanks!