Deutsch English Français Italiano |
<veevft$aqpc$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lem Novantotto <Lem@none.invalid> Newsgroups: comp.unix.shell Subject: Re: Different variable assignments Date: Sat, 12 Oct 2024 23:07:41 -0000 (UTC) Organization: A noiseless patient Spider Lines: 46 Message-ID: <veevft$aqpc$1@dont-email.me> References: <lmt83dFsvbvU3@mid.individual.net> <lmt90sFr1idU1@mid.individual.net> <lmta1jFsvc0U1@mid.individual.net> <vecl6n$d0r$1@dont-email.me> <lmuniuF632tU1@mid.individual.net> <vedlc2$4vi6$1@dont-email.me> <vedofj$5g3v$1@dont-email.me> <lmvkisF860uU2@mid.individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 13 Oct 2024 01:07:41 +0200 (CEST) Injection-Info: dont-email.me; posting-host="42a66be9b83a86cad0effc1bfd61b3e1"; logging-data="355116"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J4BtBnnu5X/2SroIiOH8QWLfd9MrpDqE=" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:shbmU4YFfO7l/AiMqKl4bOEMLJM= Bytes: 3050 Il Sat, 12 Oct 2024 17:57:16 +0200, Frank Winkler ha scritto: > I'm still thinking about the difference between "< <(...)" and "<<<`...`" As already pointed out by Lawrence: 1) "command2 <<<`command1`": `command2`, equal to the preferable[*] $(command2), can be seen as the output of command2: a string. So with <<< you are telling the shell to take this string as input on the standard input of command2. So: execute command1, then take its output as the input of command2. This is called *command* substitution: substitution of a command with its output. [*] No characters are special between parenthesis: easier. 2) "command2 < <(process_of_command1)": here process, which is the "active running instance" of command1 - enough: remove the difference, think of command1 and stop - is run with its output connected to a named FIFO pipe file (or to some file in /dev/fd). So <(process_of_command1) is expanded as the name of this file. The first < is simple input redirection. So: execute command1, connect the output of its process to a special file, redirect this special file to input of command2. This is called *process* output substitution: substitute a process with the name of its output file. Process substitution does work only on systems supporting named pipes or /dev/fd/... so it's less universal than command substitution. Some practical differences. For example, try: $ cat <<<$(while true; do echo yes; done) Nothing: cat is waiting for the other stuff to end. But it won't end, in this case! Gawsh! $ cat < <( while true; do echo yes; done) Rock'n'roll! > And I would be happy with this one if there was a notation "the other > way round" ... something like "... >>> $var" You're more the straightforward type of guy, eh! That's fine! ;) But, sorry, '>>>' is still to come. In bash, at least. :-) -- Bye, Lem