replacing parameter in shell script

I have a script file as below named test1.sh

sed -e 's/xxxkeys/$1/g' template1.asp > template1.txt
sed -e 's/xxxkeys/$2/g' template2.asp > template2.txt
sed -e 's/xxxkeys/$3/g' template3.asp > template3.txt
sed -e 's/xxxkeys/$4/g' template4.asp > template4.txt

I want to replace $1 with a, $2 with b, $3 with c and $4 with d in test1.sh file

  • Please suggest me a simple shell script to replace values above
  • or Please suggest me how can I pass values from prompt

Thanks

One way is to use " instead of '

sed -e "s/xxxkeys/$1/g" template1.asp > template1.txt
sed -e "s/xxxkeys/$2/g" template2.asp > template2.txt
sed -e "s/xxxkeys/$3/g" template3.asp > template3.txt
sed -e "s/xxxkeys/$4/g" template4.asp > template4.txt

usage:
test1.sh a b c d