Skip to content

Commit 1b78d43

Browse files
authored
Create vital_user_switch_function.sh
1 parent 336a307 commit 1b78d43

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

vital_user_switch_function.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# switch case 1
2+
echo "Switch case demo starts.."
3+
case $1 in
4+
start) echo "starting sq server.."
5+
echo "started..."
6+
;;
7+
stop)
8+
echo "stopping the server"
9+
echo "server stopped";;
10+
restart)
11+
echo "restarting the server"
12+
echo "server restarted"
13+
;;
14+
*)
15+
echo "You have to pass start|stop|restart"
16+
;;
17+
esac
18+
echo "Switch case is over"
19+
_________________________________________________________
20+
# switch case 2
21+
echo "Please enter the number 1 to 5 only"
22+
read num
23+
case $num in
24+
1)
25+
echo "you have type one in the correct number range"
26+
;;
27+
2)
28+
echo "you have type two in the correct number range"
29+
;;
30+
3)
31+
echo "you have type 3 in the correct number range"
32+
;;
33+
*)
34+
echo "you have to type 1 to 5"
35+
echo "you have type an invalid number range"
36+
;;
37+
esac
38+
echo "done"
39+
___________________
40+
# Functions
41+
devfn()
42+
{
43+
echo "FelloW Engineers"
44+
echo "DevOps is above the middle class"
45+
echo "Welcome to a new era"
46+
}
47+
source ./fn1.sh
48+
devfn
49+
______________________________________
50+
51+
# Script to adduser
52+
# Author Landmark Technology
53+
# This script will create a user account
54+
# You need to be root or have sudo access to execute
55+
echo -n "Enter the username: "
56+
read username
57+
echo -n "Enter the password: "
58+
read -s password
59+
adduser "$username"
60+
echo "$password" | passwd "$username" --stdin
61+
<<ST
62+
--stdin
63+
This option is used to indicate that passwd should read the new
64+
password from standard input, which can be a pipe.
65+
cat /etc/passwd to verify
66+
ST

0 commit comments

Comments
 (0)