US>Copy command execution results to the clipboard with bash output

Asked 2 years ago, Updated 2 years ago, 497 views

You can output command execution results to both standard output and files by doing the following, but can you copy command execution results to the clipboard while outputting them to standard output?

 command | tee output.txt 

Thank you for your cooperation.

bash

2022-11-04 00:10

1 Answers

If it's bash,

$echo-e'hello\nworld'|tee>(xclip-selection clipboard)
hello
world


2022-11-04 00:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.