shell
sly_dandy
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
在shell中逐行读取文件的方法
#!/bin/bash while read line do echo $line done cat filename|while read line do echo $line done 逐个获取字串的方法: wlist="abc def ghi kjl opq" for w in $wlist do echo $w done原创 2015-07-29 22:53:32 · 311 阅读 · 0 评论 -
date命令使用
(1)显示指定时间 time=xxxxxxxxx date -d "@$time" (2)显示时间的秒数值 date +%s (3)按指定格式显示时间,例如 date -d “@$time” +%Y,显示年,还有%m,%d等等 (4)time命令原创 2015-08-04 22:54:39 · 529 阅读 · 0 评论 -
shell截取文件名或目录名
var=dir/filename.suf (1)${var##*/} 删除左起最后一个‘/'字符及其左边的内容:filename.suf (2)${var#*.} 删除左起第一个‘.’字符及其左边的内容 :suf (3)${var%%/*} 删除右起最后一个‘/’字符及其右边的内容:dir (4)${var%/*} 删除右起第一个‘/’字符及其右边的内容:dir (5)${v转载 2017-12-04 10:51:50 · 2454 阅读 · 0 评论
分享