MIT-Curricular/OS/bash/Week4/solutions.md

14 lines
567 B
Markdown
Raw Normal View History

## Lab 4
### Lab Exercises
2025-01-31 09:55:05 +05:30
Q1. `q1.sh` - Duplication - `cp` of `$1` arg (first argument).
2025-01-31 09:55:05 +05:30
Q2. `q2.sh` - Deletion - `rm` of all `$@` files using `for` loop.
2025-01-31 09:55:05 +05:30
Q3. `q3.sh` - String Sort - Selection sort using loops and `if` and `echo`.
2025-01-31 09:55:05 +05:30
Q4. `q4.sh` - File TypeCounter - Word/Line/CharCount of file via switch `case` statement and passing various commands. Command: `./q4.sh -wordcount new.txt`
2025-01-31 09:55:05 +05:30
Q5. `q5.sh` - Pattern Recognition - `grep` for finding the pattern, `sed` for deleting the pattern, and `exit` for killing the pattern. Command: `./q5.sh "hello" new.txt`