![]() ![]() This part is important to understand before you jump-in and might give you few ideas about how it can be used. You might also question the missing backslash quote in the second example. I included the unbuffered cat call because I'm unclear about the current stdout direction, but its probably redundant (almost certainly it is as written anyway) and the pipeline can probably end right at tee. as a matter of course and can easily be tee'd off of a single pipe. So all of the terminal stdout from any of the code executed in your heredoc is piped out from. 's in, it also provides you a single, simple, outpoint. ![]() But if you think about it, in the same way the heredoc streams all of your code to. ![]() 's purpose is to execute in the current shell environment, which is probably what you want, and, depending on your shell, is a lot more likely to work with a heredoc than with a standard anonymous pipe.Īnyway, as you've probably noticed, I still haven't answered your question. You can do the same with sh, of course, but. Is probably at least as unwise as it looks. This same method works on pipes, by the way: cat. If the /proc/self path gives you trouble try /dev/fd/n or /proc/$$. builtin, but not without specifying a specific path for. The heredoc's contents are streamed to the file descriptor you specify, which is in turn then interpreted as shell-code and executed by the. Most people just point it at stdin and shoot, but I find sourcing scriptlets this way can keep stdin free and the constituent apps from complaining about blocked I/o paths. I've looked around but I haven't seen many examples of the use of the redirection fd number as I've shown above in combination with the heredoc operator, though its usage is clearly specified in the POSIX basic shell-command guidelines. When you open the heredoc you signal the shell with an IOHERE input token that it should redirect its input to the file-descriptor you specify until it encounters the other end of your limiter token. source it for an efficient, POSIX-friendly general collector model. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |