Re: Different variable assignments

Liste des GroupesRevenir à cu shell 
Sujet : Re: Different variable assignments
De : usenet (at) *nospam* f.winkler-ka.de (Frank Winkler)
Groupes : comp.unix.shell
Date : 24. Oct 2024, 22:43:59
Autres entêtes
Message-ID : <lnvtcvFk4dU2@mid.individual.net>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird Beta
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

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