crontab bash tests
Ralf Mardorf
kde.lists at yahoo.com
Tue Sep 26 12:08:33 UTC 2023
On Tue, 2023-09-26 at 13:55 +0200, Ralf Mardorf wrote:
> Btw. what happens if the "touch" command does fail?
> If "touch" fails, then bash does continues with the "rm" command!
> Could there be race condition? Something writes to the file and "touch"
> isn't allowed to access the file at the same time?
>
> • rocketmouse at archlinux ~/Desktop
> $ [[ $(true)$? -eq 0 ]] && false || echo "Hello Kitty"
> Hello Kitty
When using "if then else" by an unreadable line, it would be more secure
instead of using "equal to", to use "not equal to", so at worst "touch"
does run after "rm" doesn't exeute with status 0. Something like this
doesn't happen when using a human readable script with "then" and "else"
or "case in" instead of "if".
More information about the ubuntu-users
mailing list