Re: Different variable assignments

Liste des GroupesRevenir à cu shell 
Sujet : Re: Different variable assignments
De : nn.throttle (at) *nospam* xoxy.net (Helmut Waitzmann)
Groupes : comp.unix.shell
Date : 11. Oct 2024, 21:20:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <83y12u2xyt.fsf@helmutwaitzmann.news.arcor.de>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
 Frank Winkler <usenet@f.winkler-ka.de>:
Hi there ! >
>
Consider the following commands: >
>
>
$ var1=`uname -sr`
$ echo $var1
Darwin 24.0.0
$ read var2 <<< `uname -sr`
$ echo $var2
Darwin 24.0.0
$ uname -sr | read var3
$ echo $var3
>
$ uname -sr | read -p var3
$ echo $var3
>
$
>
While the first two ones behave like expected, I wonder why the latter ones fail. What's the difference behind the scenes? >
>
And even more confusing, why does this familiar one work anyway? >
>
$ sw_vers | while read line; do echo $line; done
ProductName: macOS
ProductVersion: 15.0.1
BuildVersion: 24A348
$
>
I've been using commands like that one for a very long time and that's why I tried the simple "read" above - with no success. >
>
How can I do such an assignment at the end of a command instead of the beginning? Any ideas? >
   uname -sr | { read var3 ; echo $var3 ; }

Date Sujet#  Auteur
11 Oct 24 * Different variable assignments60Frank Winkler
11 Oct 24 +* Re: Different variable assignments33John-Paul Stewart
11 Oct 24 i`* Re: Different variable assignments32Frank Winkler
12 Oct 24 i `* Re: Different variable assignments31Janis Papanagnou
12 Oct 24 i  +* Re: Different variable assignments5Lawrence D'Oliveiro
19 Oct 24 i  i`* Re: Different variable assignments4Kenny McCormack
19 Oct 24 i  i `* Re: Different variable assignments3Janis Papanagnou
19 Oct 24 i  i  `* coprocs in bash & ksh (Was: Different variable assignments)2Kenny McCormack
19 Oct 24 i  i   `- Re: coprocs in bash & ksh (Was: Different variable assignments)1Janis Papanagnou
12 Oct 24 i  +* Re: Different variable assignments24Frank Winkler
12 Oct 24 i  i+- Re: Different variable assignments1Lawrence D'Oliveiro
12 Oct 24 i  i`* Re: Different variable assignments22Janis Papanagnou
12 Oct 24 i  i +* Re: Different variable assignments20Lem Novantotto
12 Oct 24 i  i i`* Re: Different variable assignments19Frank Winkler
12 Oct 24 i  i i +* Re: Different variable assignments3Lem Novantotto
19 Oct 24 i  i i i`* lastpipe (Was: Different variable assignments)2Kenny McCormack
19 Oct 24 i  i i i `- Re: lastpipe (Was: Different variable assignments)1Lem Novantotto
12 Oct 24 i  i i +* Re: Different variable assignments4Lawrence D'Oliveiro
12 Oct 24 i  i i i`* Re: Different variable assignments3Janis Papanagnou
12 Oct 24 i  i i i `* Re: Different variable assignments2Lawrence D'Oliveiro
12 Oct 24 i  i i i  `- Re: Different variable assignments1Janis Papanagnou
13 Oct 24 i  i i +* Re: Different variable assignments3Lem Novantotto
13 Oct 24 i  i i i+- Re: Different variable assignments1Lem Novantotto
13 Oct 24 i  i i i`- Re: Different variable assignments1Lem Novantotto
15 Oct 24 i  i i `* Re: Different variable assignments8Frank Winkler
24 Oct 24 i  i i  `* Re: Different variable assignments7Frank Winkler
24 Oct 24 i  i i   +* Re: Different variable assignments3Kenny McCormack
24 Oct 24 i  i i   i`* Re: Different variable assignments2Frank Winkler
25 Oct 24 i  i i   i `- Re: Different variable assignments1Janis Papanagnou
25 Oct 24 i  i i   `* Re: Different variable assignments3Lem Novantotto
25 Oct 24 i  i i    `* tee with no args is a no-op (Was: Different variable assignments)2Kenny McCormack
25 Oct 24 i  i i     `- Re: tee with no args is a no-op (Was: Different variable assignments)1Lem Novantotto
12 Oct 24 i  i `- Re: Different variable assignments1Frank Winkler
19 Oct 24 i  `- lastpipe (Was: Different variable assignments)1Kenny McCormack
11 Oct 24 `* Re: Different variable assignments26Helmut Waitzmann
11 Oct 24  +* Re: Different variable assignments23Frank Winkler
11 Oct 24  i+* Re: Different variable assignments21Lawrence D'Oliveiro
19 Oct 24  ii`* Re: Different variable assignments20Kenny McCormack
19 Oct 24  ii `* Re: Different variable assignments19Janis Papanagnou
19 Oct 24  ii  +* coproc or whatever in bash and ksh (Was: Different variable assignments)4Kenny McCormack
19 Oct 24  ii  i`* Re: coproc or whatever in bash and ksh (Was: Different variable assignments)3Janis Papanagnou
19 Oct 24  ii  i +- Re: coproc or whatever in bash and ksh (Was: Different variable assignments)1Janis Papanagnou
19 Oct 24  ii  i `- Re: coproc or whatever in bash and ksh (Was: Different variable assignments)1Kenny McCormack
19 Oct 24  ii  `* Re: Different variable assignments14Lawrence D'Oliveiro
20 Oct 24  ii   `* Re: Different variable assignments13Kenny McCormack
20 Oct 24  ii    `* Re: Different variable assignments12Janis Papanagnou
20 Oct 24  ii     `* coprocs - again (Was: Different variable assignments)11Kenny McCormack
25 Oct 24  ii      `* Re: coprocs - again (Was: Different variable assignments)10Janis Papanagnou
25 Oct 24  ii       +* Re: coprocs - again (Was: Different variable assignments)8Lawrence D'Oliveiro
25 Oct 24  ii       i+* Re: coprocs - again (Was: Different variable assignments)6Janis Papanagnou
25 Oct 24  ii       ii`* Subjective "valuations" are all we have (Was: coprocs - again (Was: Different variable assignments))5Kenny McCormack
25 Oct 24  ii       ii `* Re: Subjective "valuations" are all we have (Was: coprocs - again (Was: Different variable assignments))4Janis Papanagnou
25 Oct 24  ii       ii  +- Re: Subjective "valuations" are all we have (Was: coprocs - again (Was: Different variable assignments))1Lem Novantotto
25 Oct 24  ii       ii  `* Re: Subjective "valuations" are all we have (Was: coprocs - again (Was: Different variable assignments))2Kenny McCormack
26 Oct 24  ii       ii   `- Re: Subjective "valuations" are all we have (Was: coprocs - again (Was: Different variable assignments))1Janis Papanagnou
25 Oct 24  ii       i`- Re: coprocs - again (Was: Different variable assignments)1Kenny McCormack
25 Oct 24  ii       `- How to do multiple concurrent coprocs in ksh (Was: coprocs - again (Was: Different variable assignments))1Kenny McCormack
12 Oct 24  i`- Re: Different variable assignments1Christian Weisgerber
15 Nov 24  `* Re: Different variable assignments2Kenny McCormack
16 Nov 24   `- Re: Different variable assignments1Lem Novantotto

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal