![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
sly_dandy
这个作者很懒,什么都没留下…
展开
-
在shell中逐行读取文件的方法
#!/bin/bashwhile read linedo echo $linedone cat filename|while read linedo echo $linedone逐个获取字串的方法:wlist="abc def ghi kjl opq"for w in $wlistdo echo $wdone原创 2015-07-29 22:53:32 · 253 阅读 · 0 评论 -
date命令使用
(1)显示指定时间time=xxxxxxxxxdate -d "@$time"(2)显示时间的秒数值date +%s(3)按指定格式显示时间,例如date -d “@$time” +%Y,显示年,还有%m,%d等等(4)time命令原创 2015-08-04 22:54:39 · 349 阅读 · 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 · 2307 阅读 · 0 评论