#!/bin/bash
#辉哥在一个目录下面收索文件
if [ $# -le 0
then
echo 请输入要查找的文件开始
read filehead
echo 请输入要查找的路径
read filepath
let count=`ls $filepath|grep -c ^$filehead`
echo 共查找到$count个以$filehead开头的文件;
ls $filepath|grep ^$filehead
else
case $1 in
-n) echo 你要以$2为开始查找文件
echo 请输入要查找的文件路径:
read path
let num=`ls $path|grep -c ^$2`
if [ $num = 0 ]
then
echo 没有查找到以$2开头的文件
else
echo 共查到$num个以$2开头的文件
ls $path|grep ^$2
#此处开始复制文件在当前路径
fi;;
*) echo 没有此命令!;;
esac
fi