Re: Script challenge
On Sat, 14 Jan 2006 12:26:35 +0100
Matthijs <vanaalten@hotmail.com> wrote:
> On Sat, 14 Jan 2006 11:40:13 +0100, John Smith <netman1@home.nl>
> wrote:
>
> > 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
>
>
> Exactly *what* doesn't work? If I execute is at 12:25 as follows:
>
> > ./newscriptfile.sh 1
> 12 26
>
> ... seems correct to me. What error do you get?
> --
> Matthijs
> vanaalten@hotmail.com
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
Matthijs,
I got
hostname:~# ./test.sh
./10.sh: line 2: + : syntax error: operand expected (error token is " ")
hostname:~#
To get this got to execute the whole part, not only the part after
the cat till the EOF. That part works.
Sincerely,
Jan.
Reply to: