没æ人çä½ è¿ç§å¹¼ç¨é®é¢åï¼é£æ大æ
大æ²çåè¯ä½ 好äºï¼
#! /bin/bash
if [ x$1 != x ];then
if [ ! -f "$1" ];then
echo "$1 is file"
elif [ ! -d "$1" ];then
echo "$1 is directory"
elif [ ! -b "$1" ];then
echo "$1 is block device"
elif [ ! -c "$1" ];
echo "$1 is character device"
elif [ ! -L "$1" ];then
echo "$1 is symbolic link"
else
echo "$1 is other file type!"
fi
else
echo "Useage:"
echo "./testfile [file name]"
fi
ä¿å为testfileï¼ç¶åchmod 766 testfileï¼å¨bashä¸æ§è¡
./testfile [file name]
å°±ä¼è¿å[file name]çæ件类åã