Question

I'm using alot readlink command, and what I'm trying to do is to create a short cut for this. I've added this to ~/.bashrc

rl() { readlink -f "$1" | xclip -i -selection clipboard; }

But when I want to paste it by pressing ctrl+v , terminal is trying to execute a command. Which is not what I want, I suspect it because there is a newline character at the end.

So the question is how to make this command copy to the clipboard and make the cursor stay at the the same line when pasting it?

Was it helpful?

Solution

Just found an answer:

   -n, --no-newline
          do not output the trailing newline
rl() { readlink -fn "$1" | xclip -i -selection clipboard; }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top