Arguments used in shell scripting
Shell scripting is being used to automate various tasks rather than performing every single step again and again. In shell scripting, we can use arguments to take input from the user itself to make the script work according to the user. Arguments can also be defined as the variables that can be used or accessed within a script code.
Syntax:- ./script_name $0(arg1) $0(arg2) $2(arg3)
$0 - The name of the script.
$1 - First argument that is passed from the command line.
$2 - Second argument.
Task 1:Write Shell script using arguments
In the first task, we have to write a script using three arguments that are defined above. The script contains three arguments [First is the directory name, Second is the start no. of the directories, and Third is the end no. of directories.] With this, it can create a specific number of directories according to the user input.
After Running the script and taking inputs from the user it will create specified number of directories i.e 90 directories.
Task 2: Automate Backup using crontab and shell scripting
Crontab: To automate backup using a script.
cron
can be defined as a system that is being used to schedule any task in a given period by the users.
crontab
can be defined by the table containing all the cron entries or cron files defined by the user.
The time interval can be set or defined by using the following table:
User Management
In the Linux operating system, a user can be defined as an entity by which a particular user an user to performs operations and manipulates files. Every user is assigned a unique ID in the operating system.
Different user management operations:
useradd
- To create a useruserdel
- To delete a user from the operating systemusermod
- To modify the user propertiesid
- To display user information
The user with a unique ID are created in the operating system.
Thanks for reading!
#devops#90DaysofDevops#TrainWithShubham
Let's connect on Linkedin - https://www.linkedin.com/in/piyush-verma-8b1b4426a/