# Day 5: Basic Linux Shell Scripting (Part-2)

### Let's code something. 😃

On Day 4, we learned about bash scripting. Let's use this knowledge to have some fun on our own *(solutions are at the end)*.

1. Create an output file with the names **DevOpsDays\_1** to **DevOpsDays\_10** using a bash script *(take the filename and the number of days as arguments).*
    
    Output:
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719857242066/57fcd7fe-49bc-4a0c-ad76-9781cdb1e2f6.png align="center")
    
2. Create a bash script to back-up your files or folders. (*The script should take two arguments: one for the source file or folder and another for the destination or backup folder).*
    
3. Create a Bash script that counts the number of errors in a report file *(pass the log file as an argument to the script)*.
    
4. Create a Random Joke Generator using the **JokeAPI.***(You may need to install jq to run this script).*
    
5. Create a random password generator (*pass the password length as an argument).*
    
    Output:
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719917960291/26bf9aae-295f-4129-b5eb-4df427080fef.png align="center")
    

### Solutions.🙂

1. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719864695682/806b0ca3-c558-47c1-b425-4cabc177786c.png align="center")
    
2. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719864954031/b4254cc5-b5d8-44b2-94a1-d6f72532ee75.png align="center")
    

*There are other cool methods to create backups. I highly recommend looking into those as well. Some of them are:*

**Using rsync**:

* **Rsync** is a powerful utility for efficiently copying and synchronizing files between directories or systems.
    
* It only transfers the differences between files, making it ideal for backups.
    

**Scheduled Backups with Cron**:

* Set up a cron job to run your backup script at regular intervals (e.g., daily or weekly).
    

**Automated Backup Tools**:

* Consider using tools like **Bacula**, **Amanda**, or **Duplicity** for more advanced backup management.
    
* These tools provide features like encryption, incremental backups, and centralized management.
    

3. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719866646135/62b38a51-05da-4deb-92fb-5f29c234cf8c.png align="center")
    
4. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719870256735/51d39b16-fc3f-4852-9185-545139e4e404.png align="center")
    
5. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719918011736/94094834-cdfe-4ec8-9726-6d3b6be93af2.png align="center")
    

### Other resources. ❤️

Here is another good resource for learning the **Linux Command Line.**

%[https://youtube.com/playlist?list=PLS1QulWo1RIb9WVQGJ_vh-RQusbZgO_As&si=Jbwax33TUBGLUa7o] 

Thank you for reading😉.
