On Sat, Feb 12, 2022 at 7:03 AM David Hobach <[email protected]> wrote:

> Dear all,
>
> just stumbled across it and was wondering what a reviewer would expect
> from this code to do:
>
> ```
> #!/bin/bash
>
> function badCode {
> echo "bad code executed"
> }
>
> function testCode {
> #pick some existing file, nonexisting works too though
> echo "/etc/passwd"
> }
>
> function tfunc {
>    local foo=
>    foo="$(testCode)" || {echo "foo";}
>    cat "$foo" || {
>          badCode
>          case $? in
>           *)
>             exit 1
>          esac
> }
> }
>
> echo "Finished."
> ```
>
> At least on my amchine it executes "badCode" in both domU and dom0.
> I guess it's a bash bug and reported it accordingly, but anyway...


I’m not exactly sure what’s going on (and can’t bash right now) but output
grouping requires white space around { and } so that’s at least one problem
on the foo= assignment line. Maybe it’s being interpreted as closing the
function definition early?

B


>

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-devel/CAOajFefG3%2Bj%2BAnP-wcnM5RBHMy_%3DJE%2BJvLVttPiodWm07x8ywA%40mail.gmail.com.

Reply via email to