Hi all,
I'm writing a program that scans a file for a name and/or number the user enters ie:
$ sh phone.sh "Sally Turner"
or
$ sh phone.sh Bob 12345678
I've got it mostly working except when I use "" to try make a full name one argument ie "sally turner" it scans for a turner file in the current directory or when "Sally Turner" 12345678 is entered searches for Turner12345678. I think the "" are not removing the space making it read:
grep "Sally Turner" directory.txt
as
grep Sally Turner directory.txt
My question is does grep have an option that fixes this problem?
Here's the chunk of code with the problem:
grep $1$2 directory.txt > /dev/null
work=$?
if [ $work -ne 1 ]
then
grep $1$2 directory.txt
else
echo "Adding new entry to directory..."
$input >> directory.txt
sleep 1
echo "Entry added"