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

Marc Chantreux <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <Z1_v9XlKOIs_UYRL@prometheus>
On Sat, Dec 14, 2024 at 06:36:51PM -0500, Lawrence Velázquez wrote:
> https://www.in-ulm.de/~mascheck/various/bourne_args/#endnote

very interesting!

> 	% if ! ( true ) { print true }

I would like to signal here that braces work too so:

* you avoid a fork
* you can have side effects in the tests

	if (x=34; true) echo -n 'tadaaaa: '; echo ${x:-NONE}
	if {x=34; true} echo -n 'tadaaaa: '; echo ${x:-NONE}

	tadaaaa: NONE
	tadaaaa: 34

> sublists, which POSIX calls AND-OR lists.  For example, this:

To me this is weird because it means punctuations are not treated
the same way: \n ; | && || should be treated equally

in zsh (AFAIU) it's not consistant with the function declaration:

	foo() hostname && hostname
	echo tadaaaa:
	hostname

	# prometheus
	# tadaaaa:
	# prometheus

	if {true} hostname && hostname
	echo tadaaaa:

	# prometheus
	# prometheus
	# tadaaaa:

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.