开发者

Unix: command to strip white space characters

开发者 https://www.devze.com 2023-02-21 05:21 出处:网络
When I do the following unix command: pwd | pbcopy is there something I can add to the command so that the string copied to my clipboard does not have any trailing whitespace?

When I do the following unix command:

pwd | pbcopy

is there something I can add to the command so that the string copied to my clipboard does not have any trailing whitespace?

(fyi: The reason I ask is becau开发者_JAVA百科se when I pipe the output to pbcopy, it copies a newline character at the end, which for my purposes, I don't want)


You can achieve that effect with:

echo -n `pwd` | pbcopy
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号