-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentDetails_and_Regex.sh
More file actions
46 lines (36 loc) · 886 Bytes
/
StudentDetails_and_Regex.sh
File metadata and controls
46 lines (36 loc) · 886 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
#!/usr/bin/bash
flag=true
echo "Date: $(date)"
pid=$!
read -p "Enter your Register Number: " regno
read -p "Enter your name: " name
read -p "Enter your email_id: " email_id
echo "Printing user details..."
sleep 3
echo "****"
sleep 2
echo "*********"
sleep 2
echo "************"
sleep 1
echo " ****User Details**** "
echo "*******************************************************"
echo "Name: $name"
sleep 1
echo "Distros UserName: $(whoami)"
sleep 1
echo "RegNo: $regno"
sleep 1
# Regular expression for email username verification
regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
if [[ $email_id =~ $regex ]]; then
echo "Email: $email_id"
else
echo "Error: Invalid email address"
fi
echo "*********************************************************"
read -p "Would you like to exit? (y/n): " ch
if [[ $ch =~ ^[Yy]$ ]]; then
echo "Exiting..."
exit 0
fi