日期:2014-05-16 浏览次数:20857 次
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
read -p "input the dir:" dir
if [ "$dir" == "" -o ! -d "$dir" ]; then
echo "not dir"
exit 1
fi
filelist=$(ls $dir)
for file in $filelist
do
if [ -f "$file" ]; then
echo "File: $file"
elif [ -d "$file" ]; then
echo "Dir: $file"
else
echo "Others : $file"
fi
done
Others : Audiobooks
Others : desktop
Others : IBM
Others : libgooglepinyin
Others : maple
Others : maple12
Others : Podcasts
Others : Program
Others : rational
Others : reg
。。。。。