当前位置:网站首页>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
边栏推荐
- Help, boost and take responsibility, the new value and significance of the 6th Tuba rabbit 718 national home decoration Festival
- Why is domestic Xinguan oral medicine a drug for the treatment of AIDS
- 面试好难啊!蚂蚁金服的六轮面试我是强撑过来!差点OUT(面试复盘)
- 【数据库系统概论(王珊)】第1章——绪论
- #yyds干货盘点# 面试必刷TOP101:链表内指定区间反转
- Fast parsing combined with Huatu document encryption software
- 初识多态
- How to learn C language? This article gives you the complete answer
- MLX90640 红外热成像仪测温传感器模块开发笔记(七)
- Database hyperphone (I)
猜你喜欢
![[OBS] newsocketloopenable network optimization](/img/ef/ae95f94ccd9389498eebf61ba40508.png)
[OBS] newsocketloopenable network optimization

大排量硬核产品来袭,坦克品牌能否冲破自主品牌天花板?

Hegong sky team vision training Day7 - vision, Jetson naon and d435i

KMP template - string matching

Microsoft silently donated $10000 to curl, which was not notified until half a year later

交换机和路由器技术-02-以太网交换机工作原理

Because the employee set the password to "123456", amd stolen 450gb data?

Following the example of IE, is the decline of Firefox inevitable?

C语言怎么学?这篇文章给你完整答案

7 岁男孩被 AI 机器人折断手指,仅因下棋太快?
随机推荐
【单片机】2.2 AT89S52的引脚功能
数据库超话(四)
Database hyperphone (II)
成本高、落地难、见效慢,开源安全怎么办?
阿里巴巴鹰眼系统简介
Lichuang EDA - layout and inspection of schematic diagram (III)
Help, boost and take responsibility, the new value and significance of the 6th Tuba rabbit 718 national home decoration Festival
【单片机】2.1 AT89S52单片机的硬件组成
DDD(领域驱动设计)分层架构
灵魂一问:为什么ES比MySQL更适合复杂条件搜索?
Database hyperphone (III)
Subject 3: straight driving
Gree "not cool": the giant lawsuit ended and was reduced by large dealers. Is it too late for the new battlefield of air conditioning?
VO、DO、DTO、PO是什么
Wechat applet cloud function batch delete multiple data error: errcode: -502005 database collection not exists
Mysql: function
X-sheet development tutorial: initialization configuration custom layout
信通院陈屹力:降本增效是云原生应用最大价值
详解分布式系统的幂等
JSP自定义标签(下)