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

Re: possible bug in zsh - stderr not redirected if unsatisfied wildcard



On Mon, Apr 7, 2025, at 7:13 PM, Bart Schaefer wrote:
> On Mon, Apr 7, 2025 at 4:03 PM Ross Boulet <rossb@xxxxxxxxx> wrote:
>>
>> cartman2% ls ?? >stdout2 2>stderr2
>>
>> zsh: no matches found: ??    ß error not redirected, stdout2 and stderr2 not created
>
> This is expected behavior, globbing takes place very early in the
> command interpretation process.

FWIW bash behaves the same way with failglob enabled.

	% cat /tmp/failglob.bash
	shopt -s failglob

	rm -fr /tmp/foo
	mkdir /tmp/foo
	cd /tmp/foo

	touch a b

	ls ?? >stdout 2>stderr
	ls -1
	% bash /tmp/failglob.bash
	/tmp/failglob.bash: line 9: no match: ??
	a
	b
	%

-- 
vq




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