LinuxShell-检查指定目录是否存在shell脚本文件

#!/bin/bash
#检查指定目录下是否存在shell脚本文件
#$1 目录路径
#author=zhangqiang
#date=2013-02-26
#脚本环境变量配置
PATH=/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
export PATH
#Check Parameter
if [[ ! "$1" ]]; then
	echo "No Parameter...."
	exit 1
fi
#Is Directory exstis
if [[ ! -d "$1" ]]; then
	echo "Direcotry not found...."
	exit 2
fi

#Check Shell Files
files=`ls -l "$1" | grep .sh`
if [[ "$files" ]]; then
	echo "Yes,List:"
	echo "$files"
else
	echo "No"
fi
exit 0

你可能感兴趣的:(Linux内核)