[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: if source command.sh issue
From: |
Robert Elz |
Subject: |
Re: if source command.sh issue |
Date: |
Wed, 04 Sep 2024 23:50:44 +0700 |
Date: Wed, 24 Jul 2024 13:22:07 +0000 (UTC)
From: morshalev@morsh.c.edafarm-workstations-prod.internal
Message-ID:
<20240904151336.D40A9142EBC@morsh.c.edafarm-workstations-prod.internal>
There is no bug here.
| if source command.sh ; then
| command.sh contain 'set -e' at start. so command.sh should exit once detect
fail.
Once again, -e is bizarre, and stupid, and really shouldn't be used
almost anywhere.
Here the issue is that when a command is run as the condition of
an "if" -e doesn't apply (you wouldn't want it to). What people
fail to understand is that this applies to absolutely everything
in a function, or source'd script - -e simply does not apply if
you use it in a context like that (or one of the others where
-e is inapplicable).
Just find another way, avoid -e, you'll waste much less time
than attempting to fight against the -e rules in order to save
yourself some effort checking that everything which should work
does work. The latter seems like it should be harder when you
start out ("-e will just solve all that") but it *never* turns out
that way.
kre