获取一个时间参数,这个参数作为一类文件的后缀,统计符合这个时间参数的文件总数并输出,这shell怎么写?
例如文件有:
tttttt.2012-01-27
tttttt.2012-01-28
tttttt.2012-01-29
tttttt.2012-02-01
tttttt.2012-02-02
tttttt.2012-02-03
tttttt.2012-02-04
tttttt.2012-02-05
输入参数 2012-02
输出的统计符合条件的文件数是:5
#!/bin/sh
Param=$1
ls | grep "$1" | wc -l
呵呵
#!/bin/sh
ls | grep -c "$1"
再严谨一些ls | grep -c "$1...$"
#!/bin/sh
echo "请输入文字:\c"
read a
ls | grep ${a}