Re: Another 'What's the diff Q" (LDo will like this)

Liste des GroupesRevenir à cu shell 
Sujet : Re: Another 'What's the diff Q" (LDo will like this)
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shell
Date : 17. Sep 2024, 08:30:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vcbb68$3dfds$1@dont-email.me>
References : 1
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 17.09.2024 07:37, Kenny McCormack wrote:
(bash)  What is the difference between << and <<<, from a functionality
POV?  I.e., is there anything you can do with one but not the other?
 
I'm talking about this:
 
$ cmd << 'EOF'
...
...
EOF
$
 
vs.
 
$ cmd <<< '
...
...
'
$
 
Of course I know, as does everybody, that << is legacy and <<< is new, but
it begs the question: Why was <<< added to the language?

The '<<<' is basically only a convenience syntax for one-liners.

When it had (first) been introduced by Kornshell there was a slight
difference between the two, '<<' and '<<<'; IIRC, the '<<<' did not
create a '\n'. (I had discussed the feature with DGK the days when
it had been introduced. The result, DGK's decision, is what you see.)

 
Note that I use both constructs, as the mood suits me, but I just got to
thinking that maybe <<< doesn't actually add any new functionality.

It's actually a restriction since it doesn't allow (e.g.) to control
variable expansion (as is possible with escaping the tag ('EOF' in
your example, which prevents exüpansion, vs. unquoted/unescaped EOF ).

And, of course, Kornshell allows yet more control features with '<<';
see its man-page for the '<<#' variant.

Janis


Date Sujet#  Auteur
17 Sep 24 * Another 'What's the diff Q" (LDo will like this)15Kenny McCormack
17 Sep 24 +* Re: Another 'What's the diff Q" (LDo will like this)13Janis Papanagnou
17 Sep 24 i`* Re: Another 'What's the diff Q" (LDo will like this)12Kenny McCormack
17 Sep 24 i `* Re: Another 'What's the diff Q" (LDo will like this)11Janis Papanagnou
17 Sep 24 i  +- Re: Another 'What's the diff Q" (LDo will like this)1Kenny McCormack
17 Sep 24 i  `* Re: Another 'What's the diff Q" (LDo will like this)9Kenny McCormack
17 Sep 24 i   `* Re: Another 'What's the diff Q" (LDo will like this)8Janis Papanagnou
17 Sep 24 i    `* Re: Another 'What's the diff Q" (LDo will like this)7Kenny McCormack
17 Sep 24 i     `* Re: Another 'What's the diff Q" (LDo will like this)6Kaz Kylheku
17 Sep 24 i      `* Re: Another 'What's the diff Q" (LDo will like this)5Kenny McCormack
17 Sep 24 i       +* Re: Another 'What's the diff Q" (LDo will like this)3Kaz Kylheku
18 Sep 24 i       i`* Re: Another 'What's the diff Q" (LDo will like this)2Kenny McCormack
18 Sep 24 i       i `- Re: Another 'What's the diff Q" (LDo will like this)1Kaz Kylheku
18 Sep 24 i       `- Re: Another 'What's the diff Q" (LDo will like this)1Kaz Kylheku
17 Sep 24 `- Re: Another 'What's the diff Q" (LDo will like this)1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal