Reputation: 4327
I'm trying to create a zsh alias to copy the current pwd to clipboard
alias cpwd="pwd | pbcopy"
but the copied string always has a line break in the end of stirng, how do I remove it ?
Upvotes: 3
Views: 527
Reputation: 4327
the solution provided by @Charles Duffy works!
printf '%s' "$(pwd)" | pbcopy
and I also have found another one, using tr
pwd | tr -d '\n\r' | pbcopy
Upvotes: 1