LoginSignup
7
5

More than 5 years have passed since last update.

bashで大文字/小文字の変換

Last updated at Posted at 2018-01-01

文字列を全て小文字(or大文字)にさくっと変換したい時は,trコマンドを使うとよさそう。

小文字にする。

$ echo KOTATSU | tr '[:upper:]' '[:lower:]'
kotatsu

大文字にする。

$ echo mikan | tr '[:lower:]' '[:upper:]'
MIKAN

私の全然更新していなかったbashはversion 3.2.57で古くて,これ使えなかったので…。
[Qiita] Bashで変数を大文字小文字変換(uppercase/lowercase)する

trコマンドの詳しい使い方はこちら。
http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230906/

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5