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

Re: spaces in filenames should be a crime.



Op 28-03-17 om 16:29 schreef Ray Andrews:
> zsh creates the list all by itself ls or no ls.   ls is a passive
> recipient, there is no 'request'.  Yes?

Yes. And this applies to nearly[*] every command.

But 'ls' is not entirely passive. There are things that 'ls' *does* do
with the arguments it receives. It's true it doesn't resolve glob
patterns, but:

* If any of the arguments to 'ls' (after resolving glob patterns) are
directories, it will list the contents of those directories, and not
just the directories themselves, unless the '-d' option is given.

* It will provide extra information about the files if an option like
'-l' is given.

* It formats the output into columns if it finds itself writing directly
to a terminal. (To see the difference, try 'ls' and then
'ls | cat')

As always, read the manual page for more information.

HTH,

- M.

[*] One command it does *not* apply to is 'find'; it does glob pattern
matching by itself. But that does not disable the shell's glob pattern
resolver; the shell treats it like any other command. That's why you
have to tell the shell NOT to resolve those glob patterns by quoting
them, e.g.: find /some/dir -name '*.txt'



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