I am trying to create a shell script using another script. Following is the code.
#!/bin/bash
count=$#
cat << EOF > /tmp/kill_loop.sh
#!/bin/bash
while true;
do
for i in "$@"
do
echo $i
done
done
EOF
When I see kill_loop.sh , "$i" is empty.
#!/bin/bash
while true;
do
for i in "one two three"
do
echo
done
done
I want "$i" to be printed as such in kill_loop.sh file so that if i execute kill_loop.sh, it echoes the value 'one','two' and 'three'