当前位置:网站首页>shell常见命令(1)——变量大小写转换
shell常见命令(1)——变量大小写转换
2022-07-27 15:49:00 【helpburn】
大小写转换
将脚本的输入参数转换为大小或小写
param1=${1^^} #转换为大写
param2=${2,,} #转换为小写
echo $param1
echo $param2
变量的大小写转换
使用typeset
使用typeset设置变量保存大写还是小写,两个选项-u是大小,-l是小写。
param1=${1^^} #转换为大写
param2=${2,,} #转换为小写
echo $param1
echo $param2
typeset -l ccc
typeset -u ddd
ccc=$param1
ddd=$param2
echo $ccc
echo $ddd
使用tr
variable="ExampleCode"
uppercase=`echo $variable | tr 'a-z' 'A-Z'`
lowercase=$(echo $variable | tr '[A-z]' '[a-z]')
echo $uppercase
echo $lowercase
边栏推荐
- 【Codeforces】 A. Computer Game
- Explain the idempotence of distributed system in detail
- 奇瑞欧萌达也太像长安UNI-T了,但长得像,产品力就像吗?
- Database hyperphone (II)
- 快解析结合海典医药
- 数据库超话(一)
- 帮扶、提振、担当,第六届土巴兔718全民家装节的新价值和意义
- Lichuang EDA - PCB layout (IV)
- DDD (Domain Driven Design) layered architecture
- Establishing SSL connection without server‘s identity verification is not recommended
猜你喜欢

如何限制root远程登入,使普通用户拥有root权限

JSP自定义标签(下)

Numpy array matrix operation

High cost, difficult to implement, slow to take effect, what about open source security?
![[single chip microcomputer] 2.1 hardware composition of AT89S52 single chip microcomputer](/img/8d/27d99bf7a94e59f158ba952e9239bd.png)
[single chip microcomputer] 2.1 hardware composition of AT89S52 single chip microcomputer

Lichuang EDA - layout and inspection of schematic diagram (III)

Oracle 11g database installation tutorial

DDD(领域驱动设计)分层架构

【obs】NewSocketLoopEnable 网络优化

详解二叉树之堆
随机推荐
[single chip microcomputer] 2.1 hardware composition of AT89S52 single chip microcomputer
Rare discounts on Apple's official website, with a discount of 600 yuan for all iphone13 series; Chess robot injured the fingers of chess playing children; Domestic go language lovers launch a new pro
Run loam_ Velodyne real-time mapping
How far can invisible orthodontics go under the tuyere?
Lichuang EDA - layout and inspection of schematic diagram (III)
【数据库系统概论(王珊)】第1章——绪论
Switch and router technology-02-working principle of Ethernet switch
Hidden iframe design details of SAP ui5 fileuploader
Introduction to cue language foundation: cue is a language born for configuration
Yyds dry inventory interview must brush top101: specified interval reversal in the linked list
信号量保护之位带操作
likeshop外卖点餐系统「100%开源无加密」
What should we pay attention to when choosing the LED display screen of the stadium
泰山OFFICE技术讲座:WORD奇怪的段落边框
js实现右键菜单栏功能
详解二叉树之堆
Chery omenda is also too similar to Chang'an uni-t, but does it look like it? Is the product power like it?
【数据库系统概论(王珊)】第4章——数据库安全性
Fast analysis combined with Haidian medicine
Layout of flutter