0% found this document useful (0 votes)
15 views4 pages

SC Oppe May24

The document outlines the creation of various Bash scripts for different tasks. These include setting up a directory structure with specific files and permissions, managing file names based on case sensitivity, filtering student data from a CSV file, and formatting text in a file using SED. Each task specifies the input and expected output format.

Uploaded by

Nilay Dorlikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

SC Oppe May24

The document outlines the creation of various Bash scripts for different tasks. These include setting up a directory structure with specific files and permissions, managing file names based on case sensitivity, filtering student data from a CSV file, and formatting text in a file using SED. Each task specifies the input and expected output format.

Uploaded by

Nilay Dorlikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

You are required to create a Bash script named `setup_environment.

sh` that performs the


following operations:
2 │
3 │ 1. Creates a directory structure as specified in your current working directory.
4 │ 2. Creates files within those directories.
5 │ 3. Creates symbolic and hard links.
6 │ 4. Modifies file and directory permissions.
7 │
8 │ ### Task Details:
9 │
10 │ 1. Create the following directory structure inside the current directory:
11 │ ```
12 │ workspace/
13 │ ├── config/
14 │ ├── scripts/
15 │ └── logs/
16 │ ```
17 │ 2. Inside the `config` directory, create a file named `settings.conf`.
18 │ 3. Inside the `scripts` directory, create two files named `deploy.sh` and `cleanup.sh`.
19 │ 4. Inside the `logs` directory, create a symbolic link to `deploy.sh` named `deploy_log`.
20 │ 5. Create a hard link to `cleanup.sh` in the `scripts` directory named `cleanup_backup`.
21 │ 6. Change the permissions of the directories and files as follows:
22 │ - `workspace/`, `config/`, `scripts/`, and `logs/`: User has read, write, and execute
permissions; Group has read and execute permissions; Others have no permissions.
23 │ - `settings.conf`, `deploy.sh`, and `cleanup.sh`: User has read and write permissions;
Group has read permissions; Others have no permissions.

File: /opt/se2001/oppe1.1_problem_2/README.md
───────┼────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
───────────────────────
In a course, the instructor asked the students to submit their projects in a single file named as
the student’s roll number. A typical roll number of a student is a 10 character string which is
a combination of a four digit(decimal) year and six character hexadecimal number, e.g.
"`20201f3acd"`. The instructor specified that the name of the file should be in lower case but
some students mistakenly used uppercase for their file names. Each file name is either entirely
in lower case or entirely in upper case with numbers.
Your task is to create script `array.sh` which will have two arrays(shell variables)
named `lower` and `upper`. Array `lower` should not contain the file names that have upper
case letters and
│ array `upper` should contain all the file names that have upper case letters.
4 │
5 │ Note: The project file names are provides as standard input
6 │
7 │ **Sample Input**:
8 │ ```
9 │ 20201f3acd
10 │ 2020ABCD12
11 │ 2021a1b2c3
12 │ 2021999999
13 │ 2020EF12AB
14 │ ```
15 │
16 │ **Sample Output**:
17 │ ```
18 │ 20201f3acd
19 │ 2021a1b2c3
20 │ 2021999999
21 │ 2020ABCD12
22 │ 2020EF12AB
23 │ ```

File: /opt/se2001/oppe1.1_problem_3/README.md
───────┼────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
───────────────────────
1 │ A CSV file `student_data.csv` contains student information with columns
StudentID,Name,Age,Grade. Write a bash script `script.sh` that prints all the lines where only
one part i.e. first name or
│ last name is present but not both.
2 │
3 │ Note:
4 │ - Assume that the `student_data.csv` is present in the current working directory and is
given to the script through standard input.
5 │ e.g. `cat student_data.csv|./script.sh`
6 │ - The first name and last name as separated by a space
7 │
8 │ **Sample input**
9 │
10 │ ```
11 │ StudentID,Name,Age,Grade
12 │ 101,John Doe,20,A
13 │ abc123,Jane Smith,22,B
14 │ 104,Mike,23,C
15 │ 105,,19,D
16 │ ```
17 │
18 │ **Sample output**
19 │
20 │ ```
21 │ 104,Mike,23,C
22 │ ```

File: /opt/se2001/oppe1.1_problem_4/README.md
───────┼────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
───────────────────────
1 │ You have a text file named `input.txt` that contains multiple lines of text. Write a `SED`
script named `format_text.sed` that performs the following operations:
2 │
3 │ - Adds two new line characters after each sentence ending with a full stop.
4 │
5 │ Note that the input is provided to the script through standard input. Ex: `cat input.txt | sed
-f format_text.sed`
6 │
7 │
8 │ **Sample input**
9 │ ```
10 │ It was seven o’clock of a very warm evening in the Seeonee hills when Father Wolf
woke up from his day’s rest, scratched himself, yawned, and spread out his paws one after the
other to get rid o
│ f the sleepy feeling in their tips. Mother Wolf lay with her big gray nose dropped across
her four tumbling, squealing cubs, and the moon shone into the mouth of the cave where they
all lived. "
│ Augrh!" said Father Wolf. "It is time to hunt again." He was going to spring down hill when
a little shadow with a bushy tail crossed the threshold and whined: "Good luck go with you, O
Chief of
│ the Wolves. And good luck and strong white teeth go with noble children that they may
never forget the hungry in this world."
11 │ ```
12 │
13 │ **Sample output**
14 │ ```
15 │ It was seven o’clock of a very warm evening in the Seeonee hills when Father Wolf
woke up from his day’s rest, scratched himself, yawned, and spread out his paws one after the
other to get rid o
│ f the sleepy feeling in their tips.
16 │
17 │ Mother Wolf lay with her big gray nose dropped across her four tumbling, squealing
cubs, and the moon shone into the mouth of the cave where they all lived.
18 │
19 │ "Augrh!" said Father Wolf.
20 │
21 │ "It is time to hunt again."
22 │
23 │ He was going to spring down hill when a little shadow with a bushy tail crossed the
threshold and whined: "Good luck go with you, O Chief of the Wolves.
24 │
25 │ And good luck and strong white teeth go with noble children that they may never forget
the hungry in this world."

You might also like