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

Re: trivial question



On Mon, Dec 5, 2022, at 11:29 PM, Bart Schaefer wrote:
> On Mon, Dec 5, 2022 at 6:29 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>>
>> I just need to know when zsh is
>> going to attempt globbing and keep on the watch for that.
>
> The cases where it is going to perform globbing are more universal
> than those where it is not.
>
> This is back to the DOS vs. (unixy) shell thing.  The command name
> generally doesn't matter.  "echo" is not what's deciding whether the
> arguments that follow are glob patterns; the shell itself determines
> that before it even knows what "echo" will do, and that's going to be
> the case for every command.

You can observe this with XTRACE:

	% zsh -fxc 'echo [DM]*'
	+zsh:1> echo Desktop Documents Downloads Movies Music
	Desktop Documents Downloads Movies Music

The XTRACE output (the line beginning with "+zsh:1>") represents
the command that is actually executed.  Note that the glob has been
replaced by matching filenames.  The "echo" utility does not know
that those arguments were generated from a glob; you might as well
have typed them out by hand.

Compare and contrast with this, which does not use a glob:

	% zsh -fxc 'echo DM]'
	+zsh:1> echo 'DM]'
	DM]


-- 
vq




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