当前位置:网站首页>Common shell commands (1) -- variable case conversion
Common shell commands (1) -- variable case conversion
2022-07-27 17:55:00 【helpburn】
toggle case
Convert the input parameters of the script to case or lowercase
param1=${1^^} # Convert to uppercase
param2=${2,,} # Convert to lowercase
echo $param1
echo $param2
Case conversion of variables
Use typeset
Use typeset Set whether variables are saved in uppercase or lowercase , Two options -u It's the size ,-l It's lowercase .
param1=${1^^} # Convert to uppercase
param2=${2,,} # Convert to lowercase
echo $param1
echo $param2
typeset -l ccc
typeset -u ddd
ccc=$param1
ddd=$param2
echo $ccc
echo $ddd
Use tr
variable="ExampleCode"
uppercase=`echo $variable | tr 'a-z' 'A-Z'`
lowercase=$(echo $variable | tr '[A-z]' '[a-z]')
echo $uppercase
echo $lowercase
边栏推荐
- 如何开发一款在线Excel表格系统(上)
- 20年前,他是马云最大的敌人
- Behind every piece of information you collect, you can't live without TA
- Hegong sky team vision training Day7 - vision, Jetson naon and d435i
- C语言怎么学?这篇文章给你完整答案
- 数据库超话(一)
- Run loam_ Velodyne real-time mapping
- 数据库超话(二)
- How difficult the interview is! I was forced to survive the six rounds of interview of ant financial! Almost out (interview resumption)
- 卷积神经网络之卷积计算过程个人理解
猜你喜欢

Are those who are absent from the written examination shortlisted for the teacher recruitment interview? Henan Xiangfu: the statistics of individual candidates' scores are wrong

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

Introduction to Alibaba eagle eye system

数据库超话(一)

卷积神经网络——SSD论文翻译

Functions of C language

Zhengzhou University database course resource description

ACL 2022 | prompt based automatic depolarization: effectively reducing bias in the pre training language model

MLX90640 红外热成像仪测温传感器模块开发笔记(七)

每条你收藏的资讯背后,都离不开TA
随机推荐
likeshop外卖点餐系统「100%开源无加密」
Chery omenda is also too similar to Chang'an uni-t, but does it look like it? Is the product power like it?
VO、DO、DTO、PO是什么
numpy数组矩阵操作
卷积神经网络——YOLOV2(YOLO9000)论文翻译
【单片机】2.1 AT89S52单片机的硬件组成
Mysql database defines cursor in trigger
数据库超话(一)
二舅的外甥和他的学生们
【数据库系统概论(王珊)】第5章——数据库完整性
面试好难啊!蚂蚁金服的六轮面试我是强撑过来!差点OUT(面试复盘)
x-sheet 开发教程:初始化配置自定义布局
JDBC connection database reading foreground cannot display data
Use @ in the project created by CRA, let it recognize the @ path and give path tips
Dense optical flow extraction dense_ Flow understanding
Wechat applet realizes location map display and introduces map map without navigation
Bit band operation of semaphore protection
Gods at dusk, "cat trembles" bid farewell to the big V Era
Fast parsing combined with Huatu document encryption software
Svm+surf+k-means flower classification (matlab)