---
# System prepended metadata

title: Lab 3

---

# Lab 3

## 1. Create a simple script to print odd numbers from 1 to 10.

![](https://i.imgur.com/80maN9f.png)
![](https://i.imgur.com/JoyFyQy.png)

## 2. Create a shell script which makes new users and their corresponding passwords for 10 accounts in the system. Script should read the data from the file users.txt(you can write data to this file).

### Shell script:
![](https://i.imgur.com/MLbi3wd.png)
### Result:
![](https://i.imgur.com/nIHTqEu.png)

## 3. Provide an example of the shell script where you can pass result (not an exit code) of the executed function in a subshell to the parent’s shell

### Subshell script:
![](https://i.imgur.com/vP7mV8k.png)
### Parent script: 
![](https://i.imgur.com/MAQc3kX.png)
### Calling parent from terminal:
![](https://i.imgur.com/lAGeNtF.png)

## 4. Create script that redirects system date and disk utilization in a file with systemd.

### Creating script that redirects needed data:

![](https://i.imgur.com/RLXyo16.png)

### Creating systemd redirection service:

![](https://i.imgur.com/yWcNFtY.png)

### Running systemd service:
![](https://i.imgur.com/QxpEQTD.png)

### Output file:

![](https://i.imgur.com/Hw0YeK0.png)

