Deutsch   English   Français   Italiano  
<lnvtcvFk4dU2@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.roellig-ltd.de!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Frank Winkler <usenet@f.winkler-ka.de>
Newsgroups: comp.unix.shell
Subject: Re: Different variable assignments
Date: Thu, 24 Oct 2024 23:43:59 +0200
Lines: 33
Message-ID: <lnvtcvFk4dU2@mid.individual.net>
References: <lmt83dFsvbvU3@mid.individual.net>
 <lmvkisF860uU2@mid.individual.net> <ln7313Fc93dU1@mid.individual.net>
 <lnuidqFk4dU1@mid.individual.net> <vfdajn$3k665$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net vrMK8LZQL+YNkjUD+yYnTw4hjpX4xzuE0I6CJqvD0Il3c0q0R7
Cancel-Lock: sha1:sTlDZxuNoMXiWsNFzSOCbZ7r+cU= sha256:HrxYjU6g/WR3p0O1lSegoAH2PpWHHdTD5NdTMl1XrSw=
User-Agent: Mozilla Thunderbird Beta
Content-Language: en-US
In-Reply-To: <vfdajn$3k665$1@news.xmission.com>
Bytes: 2115

On 24.10.2024 13:21, Kenny McCormack wrote:

  >I'm going to assume bash, but there isn't much difference.  In 
particular,
  >note that $() is POSIX, so you really don't need to ever mess with ``.

I know that "$()" is POSIX but I don't feel "``" as a mess but in fact, 
I like it much better. And we're talking about ksh.

  >Also note: You do not need \ at the end of the line if the line ends 
with |
  >(also true for lines that end with || or && - and possibly others)
  >
  >Anyway, this should do it:
  >
  >     tty=$(tty)
  >     end="$(sudo openconnect -b ... |
  >	tee $tty | grep "^Session authentication will expire at" |
  >	cut -d ' ' -f 7-)"

I also know that the "``" thing should and does do it but I explicitly 
asked why the "read" approach fails and that I'd prefer a solution with 
the assignment at the end.

You're absolutely right that there's probably a more elgant and cooler 
way instead of "grep" and "cut" (maybe with "awk") but that was a quick 
one and the details can be optimized when things are working. But thanks 
for the ideas.

Regards

	fw