shell脚本如何截取子字符串

时间:2024-10-12 01:49:56

1、首先打开代码编辑器,选择bash脚本模式。

shell脚本如何截取子字符串

3、其中echo ${#start_time}是输出变量的长度。

shell脚本如何截取子字符串

5、但是想要截取到字符串最后一个字符,则要写lastone=${start_time:5:6},这里截取的确实两个字符,一定要注意。

shell脚本如何截取子字符串
© 途途旅游