forked from kcdon/Unix-Shell-Interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpert1.sh
More file actions
82 lines (69 loc) · 1.71 KB
/
expert1.sh
File metadata and controls
82 lines (69 loc) · 1.71 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
clear
echo " FILE AND DIRECTORY MANAGEMENT COMMANDS"
echo -e "\n"
echo -e "\n"
echo " 1 -- Display the file content"
echo " 2 -- Remove file"
echo " 3 -- Copy file"
echo " 4 -- List file"
echo " 5 -- Size of a file"
echo " 6 -- Exit"
echo -e "\n"
breaker=1
while [ "$breaker" -eq 1 ]
do
echo -n " Enter your choice:"
read f
if [[ $f -eq 6 ]] ; then
breaker=2
clear
exit 0
fi
if [[ $f -eq 2 ]] ; then
echo -e "Enter the filename \n or filepath(if the file isn't in the same directory) to remove:"
read filename
if [ -f $filename ] ; then
rm "$filename"
else
echo "Seems the file doesn't exist! any typos??"
fi
fi
if [[ $f -eq 1 ]] ; then
echo -e "Enter the filename \n or filepath(if the file isn't in the same directory) to display:"
read filenamer
if [ -f $filenamer ] ; then
more "$filenamer"
else
echo "Seems the file doesn't exist! any typos??"
fi
fi
if [[ $f -eq 5 ]] ; then
echo -e "Enter the filename or filepath(if the file isn't in the same directory) to show it's size:"
read filenamerr
if [ -f $filenamerr ] ; then
ls -h -l "$filenamerr" | awk '{print $5}'
else
echo "Seems the file doesn't exist! any typos??"
fi
fi
if [[ $f -eq 4 ]] ; then
echo -e "Enter the filename \n or filepath(if the file isn't in the same directory) to List:"
read filenamerrr
if [ -f $filenamerrr ] ; then
ls -l "$filenamerrr"
else
echo "Seems the file doesn't exist! any typos??"
fi
fi
if [[ $f -eq 3 ]] ; then
echo -e "Enter the filename \n or filepath(if the file isn't in the same directory) to copy:"
read filenamerrr
if [ -f $filenamerrr ] ; then
echo "enter the destination path:"
read journey
cp $filenamerrr $journey
else
echo "Seems the file doesn't exist! any typos??"
fi
fi
done