shell截取字符串
2015-10-23 17:46
525 查看
image_tag="pangu-20151021102145\""
1、用#号截取,符号-右面所有字符串
TMP=${image_tag#*-}
echo $TMP
得到20151021102145"
2、用%截取,保存左边的内容
TMP1=${TMP%\"*}
echo $TMP1
得到20151021102145
1、用#号截取,符号-右面所有字符串
TMP=${image_tag#*-}
echo $TMP
得到20151021102145"
2、用%截取,保存左边的内容
TMP1=${TMP%\"*}
echo $TMP1
得到20151021102145
相关文章推荐
- UNIX编程(一) C语言实现一个模仿bash的shell实现
- android adb shell remount failed
- shell脚本在执行时,向脚本传递参数
- bash: /usr/bin/php^M: bad interpreter: No such file or directory
- Ubuntu Error:couldn't to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
- 捣鼓vm里centos能用本地xshell连接
- XShell连接虚拟机Linux
- linux下shell脚本移动、复制文件笔记
- 采用Bash脚本性能监控过程
- shell 中数学计算总结
- shell常用命令和方法总结记录
- shell脚本read传递参数
- 多层文件夹内文件遍历函数
- shell编程报错 [: missing `]'
- Windows环境下eclipse提交到远程wordcount程序报错 at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
- shell假设判断能否上网
- Linux shell函数使用
- Gnome3提取gnome-shell.css以及修改和编译
- shell 如何实现两个表的join操作
- Linux_shell编程基础_source命令和点命令