Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.shell > #25749

Different variable assignments

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Frank Winkler <usenet@f.winkler-ka.de>
Newsgroups comp.unix.shell
Subject Different variable assignments
Date Fri, 11 Oct 2024 19:56:03 +0200
Lines 26
Message-ID <lmt75jFsvbvU1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net sGl8lk6BOle/2OCDp98IaQrTaF8IKQQnHTewV0NIL3fXX/H3Og
Cancel-Lock sha1:HnpuBRHMLTnrqdtC1dOtyTqboPE= sha256:EXzk+h/gxasU0VT5rBZVYjw7D4UR4VPVQ9x1G/NAUAQ=
User-Agent Mozilla Thunderbird Beta
Content-Language en-US
Xref csiph.com comp.unix.shell:25749

Show key headers only | View raw


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? How can I do such an 
assignment at the end of a command instead of the beginning? Any ideas?

TIA

	fw

Back to comp.unix.shell | Previous | Next | Find similar


Thread

Different variable assignments Frank Winkler <usenet@f.winkler-ka.de> - 2024-10-11 19:56 +0200

csiph-web