Skip to content

Commit 4cba04c

Browse files
Added day 16 tasks
1 parent 929b190 commit 4cba04c

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

2026/day-16/README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Day 16 – Shell Scripting Basics
2+
3+
## Task
4+
Start your shell scripting journey — learn the fundamentals every script needs.
5+
6+
You will:
7+
- Understand **shebang** (`#!/bin/bash`) and why it matters
8+
- Work with **variables**, **echo**, and **read**
9+
- Write basic **if-else** conditions
10+
11+
---
12+
13+
## Expected Output
14+
- A markdown file: `day-16-shell-scripting.md`
15+
- All scripts you write during the tasks
16+
17+
---
18+
19+
## Challenge Tasks
20+
21+
### Task 1: Your First Script
22+
1. Create a file `hello.sh`
23+
2. Add the shebang line `#!/bin/bash` at the top
24+
3. Print `Hello, DevOps!` using `echo`
25+
4. Make it executable and run it
26+
27+
```bash
28+
chmod +x hello.sh
29+
./hello.sh
30+
```
31+
32+
**Document:** What happens if you remove the shebang line?
33+
34+
---
35+
36+
### Task 2: Variables
37+
1. Create `variables.sh` with:
38+
- A variable for your `NAME`
39+
- A variable for your `ROLE` (e.g., "DevOps Engineer")
40+
- Print: `Hello, I am <NAME> and I am a <ROLE>`
41+
2. Try using single quotes vs double quotes — what's the difference?
42+
43+
---
44+
45+
### Task 3: User Input with read
46+
1. Create `greet.sh` that:
47+
- Asks the user for their name using `read`
48+
- Asks for their favourite tool
49+
- Prints: `Hello <name>, your favourite tool is <tool>`
50+
51+
---
52+
53+
### Task 4: If-Else Conditions
54+
1. Create `check_number.sh` that:
55+
- Takes a number using `read`
56+
- Prints whether it is **positive**, **negative**, or **zero**
57+
58+
2. Create `file_check.sh` that:
59+
- Asks for a filename
60+
- Checks if the file **exists** using `-f`
61+
- Prints appropriate message
62+
63+
---
64+
65+
### Task 5: Combine It All
66+
Create `server_check.sh` that:
67+
1. Stores a service name in a variable (e.g., `nginx`, `sshd`)
68+
2. Asks the user: "Do you want to check the status? (y/n)"
69+
3. If `y` — runs `systemctl status <service>` and prints whether it's **active** or **not**
70+
4. If `n` — prints "Skipped."
71+
72+
---
73+
74+
## Hints
75+
- Shebang: `#!/bin/bash` tells the system which interpreter to use
76+
- Variables: `NAME="Shubham"` (no spaces around `=`)
77+
- Read: `read -p "Enter name: " NAME`
78+
- If syntax: `if [ condition ]; then ... elif ... else ... fi`
79+
- File check: `if [ -f filename ]; then`
80+
81+
---
82+
83+
## Documentation
84+
85+
Create `day-16-shell-scripting.md` with:
86+
- Each script's code and output
87+
- What you learned (3 key points)
88+
89+
---
90+
91+
## Submission
92+
1. Add your scripts and `day-16-shell-scripting.md` to `2026/day-16/`
93+
2. Commit and push to your fork
94+
95+
---
96+
97+
## Learn in Public
98+
99+
Share your first shell scripts on LinkedIn.
100+
101+
`#90DaysOfDevOps` `#DevOpsKaJosh` `#TrainWithShubham`
102+
103+
Happy Learning!
104+
**TrainWithShubham**

0 commit comments

Comments
 (0)