On Sat, Jan 14, 2006 at 11:37:42AM +0100, John Smith wrote: > Hi All, > > which heroe can tell me why the following does not work : > > #!/bin/sh > cat <<EOF >newscriptfile.sh [snip] > It's driving me nuts!!! > > Sincerely, > > Jan. Depending on what you want cat to the newscriptfile.sh, you need to escape all the $s to prevent the parameter expansions. I.e, if you want to cat the whole script into the newscriptfile.sh without expanding any parameters on the way, you have something like this: #!/bin/sh cat <<EOF >newscriptfile.sh #!/bin/sh NOWS=\$(date +%S) NOWS=\${NOWS#0} NOWM=\$(date +%M) NOWM=\${NOWM#0} NOWH=\$(date +%H) NOWH=\${NOWH#0} FROMNOW=\$1 MINUTE=\$((\${NOWM} + \${FROMNOW})) MINUTE=\$((\${MINUTE} % 60)) HOUR=\$((\${NOWM} + \${FROMNOW})) HOUR=\$((\${HOUR} / 60)) HOUR=\$((\${NOWH} + \${HOUR})) HOUR=\$((\${HOUR} % 24)) echo \$HOUR" "\$MINUTE EOF Simo -- :r ~/.signature
Attachment:
signature.asc
Description: Digital signature