6-字符串篇
来源:互联网 发布:redis主从数据库同步 编辑:程序博客网 时间:2024/05/16 16:18
字符串截取
#!/bin/bashhostname="cat.host_name is cat.super.com"string=${hostname:3}echo $stringstring1=${hostname%.*}string2=${hostname%%.*}string3=${hostname#*.*}echo $string1echo $string2echo $string3exit 0
获取长度
#!/bin/bashbook="This is a script's book"size=${#book}size2=$(expr length "$book")echo $sizeecho $size2exit 0
流重定向
#!/bin/bashFROM='from:root@cat.super.com'TO='to:cat@cat.super.com'SUBJECT='subject:shell script'MESSAGE='This is bash shell script'F_NAME='linux_shell'cat > $F_NAME << HERE$FROM$TO$SUBJECT$MESSAGEHEREexit 0
0 0
- 6-字符串篇
- 字符串篇
- 8.2.6 复制字符串
- 8.1.6 填充字符串
- 14--6--2字符串
- 14--6--3字符串
- Exercise 6: 字符串
- (6)shell字符串
- 项目 6 - 字符串加密
- 5-6 字符串操作
- C++字符串转换篇
- C++字符串转换篇
- JS字符串截取篇
- 算法题---字符串篇
- python字符串篇
- 黑马程序员--字符串篇
- 字符串输入篇
- 算法篇-字符串-WERTYU
- Windows下的2016 最新版 Eclipse启动出现:a java runtime environment(JRE) or java dev
- 大型项目编译注意事项
- Leetcode278. First Bad Version
- 与eclipse集成的管理zookeeper工具
- springMVC笔记系列(21)——springMVC自带的上传文件功能实现
- 6-字符串篇
- c库函数编写练习
- 如何在CentOS7上安装Zabbix监控服务
- [USACO2006NOV] Roadblocks
- 如何调试手机根目录下的init,rc等类似文件
- 编译和链接的区别(转载自从入门到放弃的博客http://blog.sina.com.cn/floatingstars)
- linux下软件安装方式RPM、SRPM
- POJ 1724 Roads(深搜之寻路问题)
- RecyclerView系列之一:打造RecyclerView通用的适配器BaseAdapter