I'm trying to write a simple alias on my Mac OS X terminal to copy the current working directory. I have this:
alias cpwd="echo \`pwd\` | pbcopy; echo \"Copied \`pwd\`\""
Then I can just run the following to copy it:
Problem is that
echo pwd includes the newline at the end. So when I paste it, it executes immediately (if pasted in a terminal).
All I want to do is strip off the trialing newline, but nothing I find on the internet seems to work for me. Seen various solution involving
cut, but I can't quite get it. Seems like it would be easy to do.