crontab bash tests

Oliver Grawert ogra at ubuntu.com
Tue Sep 26 14:00:41 UTC 2023


hi,
Am Dienstag, dem 26.09.2023 um 15:13 +0200 schrieb Ralf Mardorf via
ubuntu-users:
> 
> 
> If cron would run it, where is "Hello Ernie!" shown? By a log file or
> nowhere? At least no window does open and display it.
> 
depends how your system is configured ... if you have a mailx set up
you would get mails saying "cron: "Hello Ernie"" every time the job
runs ... without mailx it indeed ends up somewhere in the journal ...

> Behind the following sarcasm is a serious message.
> 
> The message:
> 
> IMO it's to complicated to ensure that a one-liner is free from
> mistakes.

that assumes that "> /dev/null" is a mistake ... 

... it is indeed not, my point is that using "grep -q <term>" vs "grep
<term> >/dev/null" is just a lot shorter and more readable in case you
are run down by a bus and some other admin needs to decypher what your
code is doing/meaning; it is just a general KISS (keep it small and
simple) habit 


i once read a (i think it was fake) interview with hemingway where he
was asked how he'd write his short stories and he answered:

"i write a novel, then i stand on one leg and try to stike out as much
useless stuff as i can"

while this story might be made up i think it sums up what i personally
consider the "art of code" ...

... write something that works, however ugly it is (my own code usually
has >/dev/null all over the place in the first iteration), then clean
it up with best practice to shorten it and make it readable for the
next person that might take over when you are not there anymore...

but we are going greatly off topic here :) 

ciao
	oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20230926/aaeeb171/attachment.sig>


More information about the ubuntu-users mailing list