"Mastering the Linux Command Line: Advanced Techniques and Shell Scripting Unleashed"
Arguments in Shell Script
In shell scripting, arguments refer to the input values or parameters passed to a script or command when it is executed. These arguments allow you to customize the behavior of the script and make it more versatile. In most shell scripts, arguments are represented by variables that can be accessed within the script's code.
Syntax:- ./script_name arg1 arg2 arg3 ...
special variables are $0, $1, $2
$0 - The name of the scripts
$1 - First argument that is passed from the command line.
$2 - Represents the second argument.
Task 1:
The script is executed with three given arguments (one is the directory name and second is the start number of directories and the third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.
After execution script will create 90 directories.
Task 2:
Cron and Crontab, to automate the backup Script.
Cron
is a time-based task scheduler. We will automate the above backup script to run at specific intervals of time.
crontab
is a file containing all schedules of the cron jobs a user wants to run regularly.
- First, use the crontab command to create your first crontab.
Enter the values based on below values.
The backup will automatically run at a given specific time.
User Management
A user is an entity, in a Linux operating system, that can manipulate files and perform several other operations. Each user is assigned an ID that is unique for each user in the operating system.
Useradd
- To create a User.
userdel
- To delete a user
usermod
- To modify user properties
id
- To display user information
The users are created.
Thanks for reading!
#devops#90Days0fDevops#TrainWithShubham
Let's connect on Linkedin - linkedin.com/in/namya-khullar-7b5758200