Vojt??ch, et al -- ...and then Vojt??ch Zeisek said... % % Dne ned??le 21. b??ezna 2021 6:02:42 CET, David T-G napsal(a): % > Vojt??ch, et al -- % > ...and then Vojt??ch Zeisek said... % > % Dne sobota 20. b??ezna 2021 4:47:37 CET, David C. Rankin napsal(a): % > % > On 3/18/21 3:09 AM, Vojt??ch Zeisek wrote: ... % > % # shellcheck source=/home/vojta/.alias % > % { test -s "${HOME}"/.alias && . "${HOME}"/.alias; } || true % > % seems to be the correct syntax --- at least id doesn't report any ... % > Since && and || are of equal precedence, encapsulating like that does % > not change the behavior and thus does not mitigate against the possible % > problem. % % AFAIK '{ A && B; } || C' means that *if both* A and B are TRUE, C is skipped; % and *if any of* A or B is FALSE, then C is executed, isn't it? That is correct. That is also the exact behavior without the braces. Whip up a quickie script davidtg@u17383850:/tmp/and-or> ls -goh total 4.0K lrwxrwxrwx 1 7 Mar 23 08:46 Af -> testing lrwxrwxrwx 1 7 Mar 23 08:46 At -> testing -rwxr-xr-x 1 109 Mar 23 08:46 testing davidtg@u17383850:/tmp/and-or> cat testing #!/bin/sh F=`basename $0` case $F in *t ) echo "$F - T" ; exit 0 ;; *f ) echo "$F - F" ; exit 1 ;; esac davidtg@u17383850:/tmp/and-or> ./Af Af - F davidtg@u17383850:/tmp/and-or> echo $? 1 davidtg@u17383850:/tmp/and-or> ./At At - T davidtg@u17383850:/tmp/and-or> echo $? 0 and go and play :-) % % > Something like % > A && { B || C } % > would, though; if A returns false, then nothing on the right is % > attempted. % > So for the original problem, I still say that it's bad distribution code % % If it is, it can be reported at https://bugzilla.opensuse.org/ and fixed, I'm % just still unsure what's the best alternative, thought... :-( No worries. I'm happy to go and chase that, presuming that that bugzilla is the right one to use. % % > to report it as a bug. % > For Vojt??ch's specific problem, % % It's not really my specific problem, I was just wondering if default code % shipped by openSUSE is the bes one. :-) Fair enough :-) % % > if you don't mind that you'll always get a true (exit code 0) result % > out of the .alias line, then you're fine, but rewrite it as % > test ! -s "$HOME/.alias" || . "$HOME/.alias" % > if you want to catch any errors out of the .alias file BUT get a 0 % > whether the file doesn't have any content or runs successfully. % % Hmmm... Exactly :-/ % % -- % Vojt??ch Zeisek % https://trapa.cz/ Have a great day! :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt