-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchdays.sh
More file actions
executable file
·71 lines (71 loc) · 1.28 KB
/
switchdays.sh
File metadata and controls
executable file
·71 lines (71 loc) · 1.28 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
#!/bin/bash
echo "enter the day"
read day
echo "$day"
case $day in
'mon') echo "create two files d1 and d2"
touch d1 d2
;;
'tue') echo "add contents to the file d1 and d2"
if [ -f d1 ]
then
echo "write content to the file d1"
read part1
echo "$part1" >> d1
else
echo "d1 file doesnt exist"
fi
if [ -f d2 ]
then
echo "write the content to the file d2"
read part2
echo "$part2" >> d2
else
echo "d2 file doesnt exist"
fi
mkdir -p temp
;;
'wed') echo "moving files d1 and d2 tp to temp folder"
if [ -f d1 ]
then
mv d1 temp/
else
echo "d1 file doesnt exist"
fi
if [ -f d2 ]
then
mv d2 temp/
else "d2 file doesnt exist"
fi
;;
'thu') echo " creating backup files"
if [ -f temp/d1 ]
then
cp temp/d1 backup1
else
echo "d1 doesnt exist"
fi
if [ -f temp/d2 ]
then
cp temp/d2 backup2
else
echo "d2 file doesnt exist"
fi
;;
'fri') echo "deleting files d1 and d2"
if [ -f temp/d1 ]
then
rm temp/d1
else
echo "d1 file doesnt exist"
fi
if [ -f temp/d2 ]
then
rm temp/d2
else
echo " d2 file doesnt exist "
fi
;;
'sat'|'sun') echo " today is holiday "
;;
esac