On 15Apr2019 11:23, felixs <besteck...@gmail.com> wrote:
Thanks, Cameron. Some coments go in between your comments.

As they should :-)

If you go:

 sed ... <path/tospoolfile/*

and that does not match a _single_ file, then the shell will not do the
redirection at all (because it can't) and sed doesn't run. This isn't a bug
in sed or the shell, just that you've asked for something nonsensical.

Well, I simply tried to use the catch-all parameter, which cannot be used
in this case. But it is accepted when having no redirection.

These are 2 different things. And I misspoke anyway.

Globbing is used to construct command line arguments. But a redirection is not a command line parameter - it is only subject to parameter substitution - $blah.

This is because a redirection opens a file and attaches the new file descriptor to the process running the command. As such it inherently is an open of one specific file, not some kind of open of many files.

If you want to process many files a redirection is the wrong tool. You have two routes: pass many files on the command line as arguments to a command which accepts many files, or use a command like "cat" to collect all the data and feed it to the target command using a pipe; in a sense a pipe is a redirection with a command on the other side instead of a file.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to