2
line="premon D0000070 0x201 0x40" # it has 26 chars
echo $line | wc -C# giving out put 27 chars.
我想刪除字符串中的額外字符..請幫忙嗎?在shell腳本中刪除字符串中的額外字符
line="premon D0000070 0x201 0x40" # it has 26 chars
echo $line | wc -C# giving out put 27 chars.
我想刪除字符串中的額外字符..請幫忙嗎?在shell腳本中刪除字符串中的額外字符
實際上,您的字符串中沒有額外的字符。 echo
在行尾放置'\ n'。如果你不想回顯字符,你可以,如果你喜歡這種答案做
echo -n $line | wc -c
感謝您的rwply .. –
@SamitKumarPatra,你可以標記這是一個回答你的問題。 – banuj
FILE1.TXT premon D0000070 0x201 0x40的 script.sh CommandFileName = $ 1 同時讀取線 ./script.sh FILE1.TXT //將它讀換行字符呢? –