To which stream does xsel print the no newline warning?
Clash Royale CLAN TAG#URR8PPP
xsel is a program with which you can access system clipboard from command line. If there is no newline at the end of copied content, it prints a warning after the clipboard content like this:
$ xsel -b
copied text
No newline at end of selection
Earlier I used to think that this warning is printed to the standard error, but today I found that the warning is not there even if the standard error is merged with the standard output.xsel-b |& less
just prints the copied text, without the warning. Why does it behave like this?
shell io-redirection stderr xsel
|
show 1 more comment
xsel is a program with which you can access system clipboard from command line. If there is no newline at the end of copied content, it prints a warning after the clipboard content like this:
$ xsel -b
copied text
No newline at end of selection
Earlier I used to think that this warning is printed to the standard error, but today I found that the warning is not there even if the standard error is merged with the standard output.xsel-b |& less
just prints the copied text, without the warning. Why does it behave like this?
shell io-redirection stderr xsel
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version ofxsel
and what is your environment?
– xhienne
Jan 13 '17 at 16:10
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.
– Barmar
Jan 13 '17 at 16:26
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00
|
show 1 more comment
xsel is a program with which you can access system clipboard from command line. If there is no newline at the end of copied content, it prints a warning after the clipboard content like this:
$ xsel -b
copied text
No newline at end of selection
Earlier I used to think that this warning is printed to the standard error, but today I found that the warning is not there even if the standard error is merged with the standard output.xsel-b |& less
just prints the copied text, without the warning. Why does it behave like this?
shell io-redirection stderr xsel
xsel is a program with which you can access system clipboard from command line. If there is no newline at the end of copied content, it prints a warning after the clipboard content like this:
$ xsel -b
copied text
No newline at end of selection
Earlier I used to think that this warning is printed to the standard error, but today I found that the warning is not there even if the standard error is merged with the standard output.xsel-b |& less
just prints the copied text, without the warning. Why does it behave like this?
shell io-redirection stderr xsel
shell io-redirection stderr xsel
edited Jan 13 '17 at 16:50
Jeff Schaller
38.6k1053125
38.6k1053125
asked Jan 13 '17 at 15:16
saga
786220
786220
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version ofxsel
and what is your environment?
– xhienne
Jan 13 '17 at 16:10
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.
– Barmar
Jan 13 '17 at 16:26
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00
|
show 1 more comment
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version ofxsel
and what is your environment?
– xhienne
Jan 13 '17 at 16:10
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.
– Barmar
Jan 13 '17 at 16:26
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version of
xsel
and what is your environment?– xhienne
Jan 13 '17 at 16:10
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version of
xsel
and what is your environment?– xhienne
Jan 13 '17 at 16:10
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.– Barmar
Jan 13 '17 at 16:26
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.– Barmar
Jan 13 '17 at 16:26
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00
|
show 1 more comment
2 Answers
2
active
oldest
votes
Note that that's the behaviour of xsel
in not yet released versions of xsel
. Introduced by this change in 2008.
It's common for X selections to contain text that doesn't end in newline characters. If you dump it as is, that results in an unterminated line being displayed. With old shells like bash
the display becomes:
bash-4.4$ xsel -b
xselbash-4.4$
(here with the CLIPBOARD selection containing xsel
). The next prompt ends up being appended to the content of the selection.
Modern shells like zsh
or fish
work around that be detecting when the output of the last command doesn't end in newline and give you a visual indication then.
With zsh
:
prompt% xsel -p
xsel%
prompt%
(the reverse-video %
after xsel
being the indication that a newline was missing).
With fish
:
prompt ~> xsel -p
x⏎
prompt ~>
Those newer xsel
give you that visual indication themselves:
bash-4.4$ xsel -b
xsel
No newline at end of selection
bash-4.4$
Now, that is only useful if xsel is run at the prompt of an old interactive shell.
In particular, that "No newline" indication would not be desirable when used as:
selection=$(xsel -b)
(where xsel
's stdout is a pipe) or:
xsel -b > selection.txt
(where xsel
's stdout is a regular file).
That's why xsel
only outputs that indication only when stdout goes to a tty device.
Now, where does it display it? Well, the intention is to display it on that tty device. If you run it under strace, you'll see:
$ strace -e write ./xsel -b
write(1, "xsel", 4xsel) = 4
write(2, "n\ No newline at end of selectio"..., 34
No newline at end of selection
) = 34
+++ exited with 0 +++
Which confirms the source: it's output on stderr. And when stdout is not a terminal:
$ strace -e write ./xsel -b > /dev/null
write(1, "$ strace -e write ./xsel -b | ca"..., 104) = 104
+++ exited with 0 +++
It's not output at all. Now one might argue it's a bit silly to output on stderr when the intent is to output that notification to the terminal (stderr could be redirected to a log file for instance as in xsel -b 2> logfile
), but:
- Generally, when stdout is a terminal device, stderr is as well.
- That means you can disable that notification when run in a terminal with
xsel -b 2> /dev/null
which would be more efficient thanxsel -b | cat
. - The
isatty()
would return true for a serial device that is not connected to a terminal.
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
add a comment |
It's simple enough to test with:
xsel -b > xsel.out 2> xsel.err
The message will be in one of the two files. If it's in xsel.out
, then the message is through standard output; if it is in the other file, then it is through standard error; if it is in neigher, then something very strange is happening, and you need to have a long, serious talk with your kernel.
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
As it happens,xsel
no longer outputs that text when stdout does not go to a terminal device.xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.
– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f337171%2fto-which-stream-does-xsel-print-the-no-newline-warning%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Note that that's the behaviour of xsel
in not yet released versions of xsel
. Introduced by this change in 2008.
It's common for X selections to contain text that doesn't end in newline characters. If you dump it as is, that results in an unterminated line being displayed. With old shells like bash
the display becomes:
bash-4.4$ xsel -b
xselbash-4.4$
(here with the CLIPBOARD selection containing xsel
). The next prompt ends up being appended to the content of the selection.
Modern shells like zsh
or fish
work around that be detecting when the output of the last command doesn't end in newline and give you a visual indication then.
With zsh
:
prompt% xsel -p
xsel%
prompt%
(the reverse-video %
after xsel
being the indication that a newline was missing).
With fish
:
prompt ~> xsel -p
x⏎
prompt ~>
Those newer xsel
give you that visual indication themselves:
bash-4.4$ xsel -b
xsel
No newline at end of selection
bash-4.4$
Now, that is only useful if xsel is run at the prompt of an old interactive shell.
In particular, that "No newline" indication would not be desirable when used as:
selection=$(xsel -b)
(where xsel
's stdout is a pipe) or:
xsel -b > selection.txt
(where xsel
's stdout is a regular file).
That's why xsel
only outputs that indication only when stdout goes to a tty device.
Now, where does it display it? Well, the intention is to display it on that tty device. If you run it under strace, you'll see:
$ strace -e write ./xsel -b
write(1, "xsel", 4xsel) = 4
write(2, "n\ No newline at end of selectio"..., 34
No newline at end of selection
) = 34
+++ exited with 0 +++
Which confirms the source: it's output on stderr. And when stdout is not a terminal:
$ strace -e write ./xsel -b > /dev/null
write(1, "$ strace -e write ./xsel -b | ca"..., 104) = 104
+++ exited with 0 +++
It's not output at all. Now one might argue it's a bit silly to output on stderr when the intent is to output that notification to the terminal (stderr could be redirected to a log file for instance as in xsel -b 2> logfile
), but:
- Generally, when stdout is a terminal device, stderr is as well.
- That means you can disable that notification when run in a terminal with
xsel -b 2> /dev/null
which would be more efficient thanxsel -b | cat
. - The
isatty()
would return true for a serial device that is not connected to a terminal.
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
add a comment |
Note that that's the behaviour of xsel
in not yet released versions of xsel
. Introduced by this change in 2008.
It's common for X selections to contain text that doesn't end in newline characters. If you dump it as is, that results in an unterminated line being displayed. With old shells like bash
the display becomes:
bash-4.4$ xsel -b
xselbash-4.4$
(here with the CLIPBOARD selection containing xsel
). The next prompt ends up being appended to the content of the selection.
Modern shells like zsh
or fish
work around that be detecting when the output of the last command doesn't end in newline and give you a visual indication then.
With zsh
:
prompt% xsel -p
xsel%
prompt%
(the reverse-video %
after xsel
being the indication that a newline was missing).
With fish
:
prompt ~> xsel -p
x⏎
prompt ~>
Those newer xsel
give you that visual indication themselves:
bash-4.4$ xsel -b
xsel
No newline at end of selection
bash-4.4$
Now, that is only useful if xsel is run at the prompt of an old interactive shell.
In particular, that "No newline" indication would not be desirable when used as:
selection=$(xsel -b)
(where xsel
's stdout is a pipe) or:
xsel -b > selection.txt
(where xsel
's stdout is a regular file).
That's why xsel
only outputs that indication only when stdout goes to a tty device.
Now, where does it display it? Well, the intention is to display it on that tty device. If you run it under strace, you'll see:
$ strace -e write ./xsel -b
write(1, "xsel", 4xsel) = 4
write(2, "n\ No newline at end of selectio"..., 34
No newline at end of selection
) = 34
+++ exited with 0 +++
Which confirms the source: it's output on stderr. And when stdout is not a terminal:
$ strace -e write ./xsel -b > /dev/null
write(1, "$ strace -e write ./xsel -b | ca"..., 104) = 104
+++ exited with 0 +++
It's not output at all. Now one might argue it's a bit silly to output on stderr when the intent is to output that notification to the terminal (stderr could be redirected to a log file for instance as in xsel -b 2> logfile
), but:
- Generally, when stdout is a terminal device, stderr is as well.
- That means you can disable that notification when run in a terminal with
xsel -b 2> /dev/null
which would be more efficient thanxsel -b | cat
. - The
isatty()
would return true for a serial device that is not connected to a terminal.
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
add a comment |
Note that that's the behaviour of xsel
in not yet released versions of xsel
. Introduced by this change in 2008.
It's common for X selections to contain text that doesn't end in newline characters. If you dump it as is, that results in an unterminated line being displayed. With old shells like bash
the display becomes:
bash-4.4$ xsel -b
xselbash-4.4$
(here with the CLIPBOARD selection containing xsel
). The next prompt ends up being appended to the content of the selection.
Modern shells like zsh
or fish
work around that be detecting when the output of the last command doesn't end in newline and give you a visual indication then.
With zsh
:
prompt% xsel -p
xsel%
prompt%
(the reverse-video %
after xsel
being the indication that a newline was missing).
With fish
:
prompt ~> xsel -p
x⏎
prompt ~>
Those newer xsel
give you that visual indication themselves:
bash-4.4$ xsel -b
xsel
No newline at end of selection
bash-4.4$
Now, that is only useful if xsel is run at the prompt of an old interactive shell.
In particular, that "No newline" indication would not be desirable when used as:
selection=$(xsel -b)
(where xsel
's stdout is a pipe) or:
xsel -b > selection.txt
(where xsel
's stdout is a regular file).
That's why xsel
only outputs that indication only when stdout goes to a tty device.
Now, where does it display it? Well, the intention is to display it on that tty device. If you run it under strace, you'll see:
$ strace -e write ./xsel -b
write(1, "xsel", 4xsel) = 4
write(2, "n\ No newline at end of selectio"..., 34
No newline at end of selection
) = 34
+++ exited with 0 +++
Which confirms the source: it's output on stderr. And when stdout is not a terminal:
$ strace -e write ./xsel -b > /dev/null
write(1, "$ strace -e write ./xsel -b | ca"..., 104) = 104
+++ exited with 0 +++
It's not output at all. Now one might argue it's a bit silly to output on stderr when the intent is to output that notification to the terminal (stderr could be redirected to a log file for instance as in xsel -b 2> logfile
), but:
- Generally, when stdout is a terminal device, stderr is as well.
- That means you can disable that notification when run in a terminal with
xsel -b 2> /dev/null
which would be more efficient thanxsel -b | cat
. - The
isatty()
would return true for a serial device that is not connected to a terminal.
Note that that's the behaviour of xsel
in not yet released versions of xsel
. Introduced by this change in 2008.
It's common for X selections to contain text that doesn't end in newline characters. If you dump it as is, that results in an unterminated line being displayed. With old shells like bash
the display becomes:
bash-4.4$ xsel -b
xselbash-4.4$
(here with the CLIPBOARD selection containing xsel
). The next prompt ends up being appended to the content of the selection.
Modern shells like zsh
or fish
work around that be detecting when the output of the last command doesn't end in newline and give you a visual indication then.
With zsh
:
prompt% xsel -p
xsel%
prompt%
(the reverse-video %
after xsel
being the indication that a newline was missing).
With fish
:
prompt ~> xsel -p
x⏎
prompt ~>
Those newer xsel
give you that visual indication themselves:
bash-4.4$ xsel -b
xsel
No newline at end of selection
bash-4.4$
Now, that is only useful if xsel is run at the prompt of an old interactive shell.
In particular, that "No newline" indication would not be desirable when used as:
selection=$(xsel -b)
(where xsel
's stdout is a pipe) or:
xsel -b > selection.txt
(where xsel
's stdout is a regular file).
That's why xsel
only outputs that indication only when stdout goes to a tty device.
Now, where does it display it? Well, the intention is to display it on that tty device. If you run it under strace, you'll see:
$ strace -e write ./xsel -b
write(1, "xsel", 4xsel) = 4
write(2, "n\ No newline at end of selectio"..., 34
No newline at end of selection
) = 34
+++ exited with 0 +++
Which confirms the source: it's output on stderr. And when stdout is not a terminal:
$ strace -e write ./xsel -b > /dev/null
write(1, "$ strace -e write ./xsel -b | ca"..., 104) = 104
+++ exited with 0 +++
It's not output at all. Now one might argue it's a bit silly to output on stderr when the intent is to output that notification to the terminal (stderr could be redirected to a log file for instance as in xsel -b 2> logfile
), but:
- Generally, when stdout is a terminal device, stderr is as well.
- That means you can disable that notification when run in a terminal with
xsel -b 2> /dev/null
which would be more efficient thanxsel -b | cat
. - The
isatty()
would return true for a serial device that is not connected to a terminal.
edited Dec 16 at 15:09
answered Jan 14 '17 at 11:39
Stéphane Chazelas
299k54563913
299k54563913
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
add a comment |
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
That software is insane.
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Dec 16 at 14:53
add a comment |
It's simple enough to test with:
xsel -b > xsel.out 2> xsel.err
The message will be in one of the two files. If it's in xsel.out
, then the message is through standard output; if it is in the other file, then it is through standard error; if it is in neigher, then something very strange is happening, and you need to have a long, serious talk with your kernel.
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
As it happens,xsel
no longer outputs that text when stdout does not go to a terminal device.xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.
– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
add a comment |
It's simple enough to test with:
xsel -b > xsel.out 2> xsel.err
The message will be in one of the two files. If it's in xsel.out
, then the message is through standard output; if it is in the other file, then it is through standard error; if it is in neigher, then something very strange is happening, and you need to have a long, serious talk with your kernel.
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
As it happens,xsel
no longer outputs that text when stdout does not go to a terminal device.xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.
– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
add a comment |
It's simple enough to test with:
xsel -b > xsel.out 2> xsel.err
The message will be in one of the two files. If it's in xsel.out
, then the message is through standard output; if it is in the other file, then it is through standard error; if it is in neigher, then something very strange is happening, and you need to have a long, serious talk with your kernel.
It's simple enough to test with:
xsel -b > xsel.out 2> xsel.err
The message will be in one of the two files. If it's in xsel.out
, then the message is through standard output; if it is in the other file, then it is through standard error; if it is in neigher, then something very strange is happening, and you need to have a long, serious talk with your kernel.
answered Jan 13 '17 at 16:25
DopeGhoti
43.1k55382
43.1k55382
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
As it happens,xsel
no longer outputs that text when stdout does not go to a terminal device.xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.
– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
add a comment |
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
As it happens,xsel
no longer outputs that text when stdout does not go to a terminal device.xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.
– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
1
1
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:
( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
It's perfectly possible for a process to write to the tty without regard for stdout or stderr:
( echo "on tty" >$(tty); echo "on stdout" >&1; echo "on stderr" >&2 ) 1>out 2>err
– Kusalananda
Jan 13 '17 at 16:57
1
1
As it happens,
xsel
no longer outputs that text when stdout does not go to a terminal device. xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.– Stéphane Chazelas
Jan 13 '17 at 16:57
As it happens,
xsel
no longer outputs that text when stdout does not go to a terminal device. xsel -b 2> xsel.err
while stdout is a terminal would store that text in xsel.err though.– Stéphane Chazelas
Jan 13 '17 at 16:57
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti the clipboard content goes to xsel.out and xsel.err is empty.
– saga
Jan 14 '17 at 5:08
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
@DopeGhoti can you help me out, the kernel is intimidating me. How should I start the conversation?
– saga
Jan 14 '17 at 5:21
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f337171%2fto-which-stream-does-xsel-print-the-no-newline-warning%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is weird. Firstly, I do not have this error message. Secondly, such a message is surprising since the vast majority of the selections do not contain a newline. What is your version of
xsel
and what is your environment?– xhienne
Jan 13 '17 at 16:10
xsel
has different behaviors depending on whether standard input or output are terminals. I suspect it only displays the error message when it's outputing to a terminal, not a pipe or file.– Barmar
Jan 13 '17 at 16:26
github.com/kfish/xsel/blob/master/xsel.c#L2259
– Stéphane Chazelas
Jan 13 '17 at 16:52
github.com/kfish/xsel/commit/…
– Stéphane Chazelas
Jan 13 '17 at 16:55
I'm on arch linux and the upstream url for xsel is vergenet.net/~conrad/software/xsel
– saga
Jan 14 '17 at 5:00