Advanced Linux Shell Scripting for DevOps Engineers with User management.

zishan sayyedzishan sayyed
2 min read

TASK 1 :-

👉Write a bash script create directories.sh that when the script is executed with three given arguments (one is the directory name and second is start number of directories and third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.??

Save this script in a file, e.g., createDirectories.sh, and make it executable using chmod +x createDirectories.sh.

To run the script, use the following commands:

This will create directories named day1, day2, day3, and so on up to day90.

TASK 2 :-

👉creating a backup script, you can create a script like this:

Save this script in a file, e.g., backup.sh, and make it executable using chmod +x backup.sh.

To automate this backup script using Cron, you can add an entry to your user's crontab by running crontab -e and adding a line like this to run the script daily at a specific time:

This will run the backup.sh script every day at 2:00 AM. Adjust the timing as needed.

TASK 3 :-

For the third task, you can create two users and display their usernames using the following commands:

This will create two users, user1 and user2, and display their usernames as specified.

I hope this will help you to understand some Linux Shell scripting.

1
Subscribe to my newsletter

Read articles from zishan sayyed directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

zishan sayyed
zishan sayyed