4-文件篇

来源:互联网 发布:linux如何开启ftp服务 编辑:程序博客网 时间:2024/06/05 20:40
文件存在性
#!/bin/bashecho "please input file name"read f_nameif [ -z $f_name ]then    echo "you don't input any file name"fiif [ -f $f_name ]then    echo "The file. exits $f_name"else    echo "No such. file"fiexit 0
文件操作
#!/bin/bashARGS=1if [ $# -ne $ARGS ]then     echo "`basename $0` filename"    exit 0fiif [ ! -f $1 ]then    echo "No such file"    exit 0fised -e 's/\.//g' -e 's/\.//g' -e 's//\/g' "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nrexit 0
0 0
原创粉丝点击