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

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



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





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