tags:

views:

36

answers:

2

Hopefully fairly straightforward, to explain the use case when I run the following command (OS X 10.6):

pwd | pbcopy

the pasteboard contains a newline character at the end. I'd like to get rid of it.

+1  A: 

pwd | tr -d '\n' | pbcopy

grep
+1  A: 
printf $(pwd) | pbcopy

or

echo -n $(pwd) | pbcopy
Dennis Williamson
First one is unsafe: there could be %'s in the string.
grep
You can make it safe like this: `printf '%s' $(pwd) | pbcopy`
Dennis Williamson