In Git Bash, when I run the below command:
echo "foo" | clip
and paste the output into a text editor, I see a new line character has been appended to the output string:
foo
<newline>
How can I prevent it from adding the trailing newline character or trim the same after getting appended?
CodePudding user response:
Directly from echo(1)
man page:
-n do not output the trailing newline
so just add the -n
option to the command: echo -n "foo" | clip
.