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.
whoami の出力を大文字に変更した後、別の変数に保存しようとしています。私を助けてください。私はシェルスクリプトの初心者です。
前もって感謝します。
純粋な使用bash
bash
x=$(whoami) v=${x^^}
使用するtr
tr
v=$(whoami | tr 'a-z' 'A-Z')
または
v=$(whoami | tr [:lower:] [:upper:])
使用するawk
awk
v=$(whoami | awk '{print toupper($0)}')
使用するperl
perl
v=$(whoami | perl -e 'print uc <>')