ok so, there were a few syntax bits, unexpected '(' and the like as i integrated the statement into the existing code.
Here is the code at the minute:
Code:
while [ $exit -ne 1 ]
do
echo "Find something for me to delete"
echo -n "-----------------------> "
read searchTerm
ifs=$IFS; IFS=$'\n'; searchOutput=$(grep $searchTerm*.$ $ADDRESSBOOK | sort); IFS=$ifs
if [[ ${#searchOutput[@]} gt 1 ]]; then
PS3="Select line to delete: "
select line in "${searchOutput[@]}";
[[ -z $line ]] && break
echo Deleting $line
else
echo Deleting $searchOutput
fi
done
exit 0
which is giving me:
Code:
Find something for me to delete
-----------------------> a
grep: /home/fr0s7y/Docume: No such file or directory
grep: ts/Address-Book/add_data.txt: No such file or directory
./delete.sh: 30: ./delete.sh: [[: not found
Deleting
strange how grep is cutting off the last couple of digits from documents, also I dont understand where the file path for 'ts/' is being declared :/
Bookmarks