昨天郁闷了半天。自从发现echo和wc命令的组合可以省去我数某个字符串的长度时,我就一直使用这个超级无敌的命令组合。但是echo 之后默认带换行(\n)有时也会带来意想不到的麻烦。
比如
echo 123456789 | wc --chars
10
去掉echo后面默认带的换行符,就对了:
echo -n 123456789 | wc --chars
9
This entry was posted
on Tuesday, December 4th, 2007 at 10:08 pm and is filed under 黄嘴企鹅|linux.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.