On Fri, Dec 2, 2022 at 10:17 AM wrote:
> I needed to show the stdout of a command as well as pass
> it to another command's stdin. This works:
>
> odin:~$ echo 1 | tee /dev/ttyp8 | sed 's/1/2/'
> 1
> 2
> odin:~$
>
> where /dev/ttyp8 is the result of the tty command:
>
Have you considered:
$
On 12/2/22 16:17, rsyk...@disroot.org wrote:
echo 1 | tee $(tty) | sed 's/1/2/'
Not 100% sure, but probably some timing/subshell issue.
This works:
tty=$(tty) && echo 1 | tee $tty | sed 's/1/2/'
best /m
rsyk...@disroot.org writes:
> Dear list,
>
> ...
>
> but this does not work:
>
> odin:~$ echo 1 | tee $(tty) | sed 's/1/2/'
> 2
> odin:~$
>
> I do not understand why...
The position of the tty command in the pipeline means that its
standard input is not the terminal:
$ echo $(tty)
Martijn van Duren wrote:
> >
> > odin:~$ echo 1 | tee $(tty) | sed 's/1/2/'
>
> tty(1) is one of the shorter applications, so it's easy to see what it
> does:
> t = ttyname(STDIN_FILENO);
> if (!sflag)
> puts(t ? t : "not a tty");
>
> Since $(tty) is part of the
On Fri, 2022-12-02 at 16:17 +0100, rsyk...@disroot.org wrote:
> Dear list,
>
>
> I needed to show the stdout of a command as well as pass
> it to another command's stdin. This works:
>
> odin:~$ echo 1 | tee /dev/stderr | sed 's/1/2/'
> 1
> 2
> odin:~$
>
> and this works, too:
>
> odin:~$
Dear list,
I needed to show the stdout of a command as well as pass
it to another command's stdin. This works:
odin:~$ echo 1 | tee /dev/stderr | sed 's/1/2/'
1
2
odin:~$
and this works, too:
odin:~$ echo 1 | tee /dev/ttyp8 | sed 's/1/2/'
1
2
odin:~$
where /dev/ttyp8 is the result of the tty
6 matches
Mail list logo