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 > #!/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 > > It's driving me nuts!!! > I don't know why it doesn't work (I know pretty little about shell programming), but the following does work (for me, anyway):
#!/bin/sh echo '#!/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' >newscriptfile.sh > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- David Jardine "Running Debian GNU/Linux and loving every minute of it." -L. von Sacher-M.(1835-1895) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]