Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これを試すと:
echo "hi" | wc -c
文字数は 2 だと思いますが、実際には 3 になります。なぜ 2 でないのか説明できますか?
デフォルトでは、echo は出力の後に改行文字を追加します。これを回避するには、 echo -nを使用します。また、 wc -c はバイトをカウントします。文字カウントには wc -m を使用します。