I am trying to copy an entire script, not the script output but the entire script as a text line inside a file named test.sh. I am using another script to execute this so that is why I didn't use a text editor like vi.
I can't use echo "" or echo '' because the script string contains double quotes and single quotes inside.
What I used and it failed was:
echo "rm disktemp;./xpinfo -i|awk '{print $1}'|grep rhdisk|sed 's!/dev/r!!'>disktemp;for i in $(cat disktemp);do ./xpinfo -i|grep $i|sed 's!/dev/r!!'|awk '{print $6","$1'};done" > test.sh
Is there any way to do this?