Re: Testing time in a korn shell script
joe_at_invalid.address
Date: 01/14/04
- Next message: see sig: "Re: Bourne Shell Script Newbie Help"
- Previous message: Daz: "Bourne Shell Script Newbie Help"
- In reply to: Stephane CHAZELAS: "Re: Testing time in a korn shell script"
- Next in thread: Stephane CHAZELAS: "Re: Testing time in a korn shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Jan 2004 19:26:49 GMT
Stephane CHAZELAS <this.address@is.invalid> writes:
> 2004-01-14, 17:53(+00), joe@invalid.address:
> [...]
> >> > STARTTIME=0545
> >> > ENDTIME=0700
> >> > GETDATE=`date +%H%M`
> >> >
> >> > if [[ "$GETDATE" -gt "$STARTTIME" && "$GETDATE" -le "$ENDTIME" ]]
> [...]
> >> The above won't work because of the leading 0 in STARTTIME and
> >> ENDTIME. The leading 0 causes arithmetic evaluations to see these as
> >> octal numbers. For example, modify the script like so
> >
> > Please ignore the gibberish I posted here. I need some more caffeine.
> [...]
>
> I don't know what you posted as you seem to have cancelled your
> post, but that's true that in ksh or zsh in ksh emulation mode
> or in bash, they will be considered as octal numbers.
Yes, it was the example that I gave which was messed up.
Joe
- Next message: see sig: "Re: Bourne Shell Script Newbie Help"
- Previous message: Daz: "Bourne Shell Script Newbie Help"
- In reply to: Stephane CHAZELAS: "Re: Testing time in a korn shell script"
- Next in thread: Stephane CHAZELAS: "Re: Testing time in a korn shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]