1 #!/bin/bash
2
3 #================================================================
4 # Copyright (C) 2021 . All rights reserved.
5 #
6 # 文件名称:var_type.sh
7 # 创 建 者:gan
8 # 创建日期:2021年04月05日
9 # 描 述:
10 #
11 #================================================================
12 set -ue
13 read -p "请输入一个路径:" DIR
14
15 cd $DIR
16
17 for file in `ls`;do
18
19
20 if [ -L $file ];then
21 echo "$file是软链接"
22 elif [ -b $file ];then
23 echo "$file是块设备文件"
24 elif [ -c $file ];then
25 echo "$file是字符设备文件"
26 elif [ -p $file ];then
27 echo "$file是管道文件"
28 elif [ -S $file ];then
29 echo "$file是套接字文件"
30 elif [ -f $file ];then
31 echo "$file是普通文件"
32 elif [ -d $file ];then
33 echo "$file是目录文件"
34 else
35 echo "$file是其他文件"
36 fi
37
38
39 done
04-28