Groups | Search | Server Info | Login | Register


Groups > comp.unix.shell > #25749

Different variable assignments

From Frank Winkler <usenet@f.winkler-ka.de>
Newsgroups comp.unix.shell
Subject Different variable assignments
Date 2024-10-11 19:56 +0200
Message-ID <lmt75jFsvbvU1@mid.individual.net> (permalink)

Show all headers | 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