Shell Script (simple problem)

I want to find and replace string from files present in one directory.
user will input the string to be searched and to replace .
Here is my program but Not working

echo "Enter Old domain name:"
read old

echo "Enter New domain name:"
read new

grep -rl '$old' /var/www/ | xargs sed -i 's/$old/$new/g'
exec bash

The grep and sed you have in the script does not modify the file you wanted to or its not the correct way to do it. Try as

michaelf>cat fil.ksh
#!/bin/ksh

echo "Enter Old domain name:"
read old

echo "Enter New domain name:"
read new

sed "s/$old/$new/g" /home/michael/infile > /home/michael/tmp

#after verifying the results in the file /home/michael/tmp, uncomment the below line to rename to the original file name
#mv /home/michael/tmp /home/michael/infile
michaelf>

i have 1000 of file in var/www/ how do i replace recursively without moving files from temp.

If your version of SED supports -i option then you could use it instead of mv command

sed -i "....

:b: Problem was with quotes :

echo "Enter Old domain name:" 
read old  
echo "Enter New domain name:" 
read new  

grep -rl "$old" /var/www | xargs sed -i "s/$old/$new/g" 
exec bash