[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash: let exp ? exp : exp problem



Sebastian Kapfer wrote:

On Sun, 13 Jul 2003 01:20:08 +0200, David selby wrote:

Hello, I am trying to get a bash script to work which will hibernate
till 1:00 am, it appears to work OK

Ahh, the bash :-)

let $_mintoone -gt 1440:_mintoone=$_mintoone-1440

	let 'toone = toone > 1440 ? toone - 1440 : toone'

should do the job. (At least if I understood your purpose correctly.)
Shorter, but with slightly different meaning:

	let 'toone %= 1440'

PS bash is addictive ...

Yup. It always stays challenging, mostly because of stupid
quoting/nonquoting issues, arcane syntax and the lack of proper error
messages.

PPS I am not using cron since the script uses xmessage and executed via
cron causes xhost access problems, just in case you were wondering ....

If you set up DISPLAY correctly, it should work IMHO.

let 'toone %= 1440' ... very neat !

The error messages certainly are challenging ... and cryptic

Many thanks
Dave




Reply to: