Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why not promote the plague ? (brace|rc|alternative|modern) syntax



hello,

On Mon, Dec 16, 2024 at 05:15:33AM -0500, Lawrence Velázquez wrote:
> > To me this is weird because it means punctuations are not treated
> > the same way: \n ; | && || should be treated equally

> I don't know what you mean by this.

Maybe because I'm not clear for myself. So let's me explain another way

* all those symbols express the end of a command: \n ; } && ||
* pipe is special because is binds two commands together so there is an
  hi prority there.
* so to me all of them should have the same priority with a left
  precedence.

  a ;  b ; c     =>>>  a ; { b ; c }
  a ;  b | c     =>>>  a ; { b | c }

but as you said

        % setopt SHORT_LOOPS
        % if { false } print foo && print bar
        %

works like this:

        if false
        then
                print foo && print bar
        fi

not this:

        if false
        then print foo
        fi && print bar

which means:
* you can't just use a single rule to guess the way zsh will act
* you can't teach this simple rule.

regards,


-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79





Messages sorted by: Reverse Date, Date, Thread, Author