find命令
find 文件名可以是全路径支持通配 -type f -exec ls {} \;
-type f是查文件类型 -exec ls {} \; 其中 {} \; 是固定格式{}表示查出来的路径
变量字符串替换
k="2342342"
${k\\3\2}或者${k\3\2}
\\和\的区别是\\是全部匹配,\是只匹配一个
截取变量中的路径
setpfName=/home/sgs/test.txt
csh:
${pfName:r} = /home/sgs/test
${pfName:e} = txt
${pfName:t} = test.txt
${pfName:h} = /home/sgs
${pfName:r:t}= test
bash
${pfName%.*} = /home/sgs/test
${pfName##*.}= txt
${pfName##*/}= test.txt
${pfName%/*} = /home/sgs
${pfName} = test (※不用其他的命令暂时不知道怎么做)
深入解析Shell脚本中常用命令与操作技巧
3万+

被折叠的 条评论
为什么被折叠?



