Re: CR/LF
On Sat 10 Dec 2022 at 23:16:12 (-0500), Jim Popovitch wrote:
> The following
> will add a CR/LF:
>
> TEST=`ssh -o LogLevel=QUIET -t user@server "echo -n ''"`; echo ${TEST}
>
> Using -n on the 2nd echo would remove a necessary CR/LF on any remote
> cmd that did produce output.
I didn't give much consideration to what's left of the semicolon.
But echo ${TEST} will always write a newline unless, quote:
-n do not output the trailing newline
-e enable interpretation of backslash escapes
The second of these allows you to spring surprises.
$ Test="abcd"
$ echo -n ${Test}
abcd$ echo ${Test}
abcd
$ Test=""
$ echo ${Test}
$ Test=
$ echo ${Test}
$ unset Test
$ echo ${Test}
$ Test="abcd\c"
$ echo -e ${Test}
abcd$
Cheers,
David.
Reply to:
- References:
- CR/LF
- From: Jim Popovitch <jim@k4vqc.com>
- Re: CR/LF
- From: David Wright <deblis@lionunicorn.co.uk>
- Re: CR/LF
- From: Jim Popovitch <jim@k4vqc.com>
- Re: CR/LF
- From: Greg Wooledge <greg@wooledge.org>
- Re: CR/LF
- From: Jim Popovitch <jim@k4vqc.com>