If I do echo foo | xclip -i
in the terminal and then Ctrl + V, I get foo
.
But instead, if I write a file,
bar.sh
#!/bin/sh
echo bar | xclip -i
and run ./bar.sh
in the terminal, the clipboard content doesn't become "bar" as I would expect.
Why? And how do I make it do to so?
I managed to do it changing the line echo bar | xclip -i
to echo bar | xclip -selection c
, but why does this way work and the other doesn't?