> an other maybe better version
>
> at the beginning (only on home computer)
> if [ "${SLEEPTIME}" ] ; then
>     SLEEPCMD="sleep ${SLEEPTIME} || true"

I don't understand the reason behind the part with "|| true"

This should do:
SLEEPCMD="type sleep && sleep ${SLEEPTIME}"

> else
>     SLEEPCMD="# don't sleep"
> fi
>
> and in the scripts you use
> "$SLEEPCMD"
>
> It should work also if sleep doesn't exist.

Yes, but is a lot uncleaner than testing for the existance of the
cammand, then running it if it does exist.


The only thing that I don't like about the solution with:

type command && command

is that it will generate noise on the console, that's why I prefer:

[ ! -z "\`type command\`" ] && command

--
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein

Reply via email to