-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.sh
More file actions
72 lines (39 loc) · 784 Bytes
/
file.sh
File metadata and controls
72 lines (39 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#File test Operators
echo -e "Enter the file name: \c "
read file_name
#flag e
if [ -e $file_name]
then
echo " $file_name FILE FOUND"
else
echo "$file_name FILE NOT FOUND"
fi
echo -e "Enter the file name: \c "
read file_name
#flag f
if [ -f $file_name]
then
echo " $file_name FILE IS REGULAR FILE"
else
echo "$file_name FILE IS NOT REGULAR FILE"
fi
#flag d for direcotry
echo -e "Enter the file name: \c "
read file_name
if [ -d $file_name]
then
echo " $file_name Direcotry found"
else
echo "$file_name Direcotry not found"
fi
#flag for regular file -c
#flag Block special file -b
echo -e "Enter the file name: \c "
read file_name
if [ -b $file_name]
then
echo " $file_name BLOCK FILE"
else
echo "$file_name REGULAR FILE "
fi