# Day 5 Task: Advanced Linux Shell Scripting for DevOps Engineers with User management

### Tasks

1. You have to do the same using Shell Script i.e using either Loops or command with start day and end day variables using arguments -
    
    So Write a bash script [createDirectories.sh](http://createDirectories.sh) that when the script is executed with three given arguments (one is directory name and second is start number of directories and third is the end number of directories ) it creates specified number of directories with a dynamic directory name.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679983484090/f022610b-2147-4161-bba7-95536a27cd8a.png align="center")
    
    Here, $1 represents the first argument i.e **test**
    
    $2 represents the second argument i.e 1
    
    $3 represents the third argument i.e 5
    
    Let's see the practical:-
    
    we have created for loop where the value of **i** will start from the **second argument i.e 1**(i=$2) and will go on incrementing (i++) till its value is smaller than or equal to argument 3 which is **5 (i&lt;=$3).**
    
    We have executed the mkdir command which will create the directory by taking the value of the first argument i.e test( *$1).*
    
    echo is used to print the output
    
    Let's execute the above script :
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679985964082/5ed64f03-e6ee-457e-9d0c-a3c448b5282e.png align="center")
    
2. Create a Script to back up all your work done till now.
    
    Here is the script:-
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679994288588/4172402c-5f3a-4561-a341-f9d421e34a44.png align="center")
    
    * now its time to break down the script
        
    * **time -** it takes the current date and time
        
    * **target-** this is the path where we need backup our files
        
    * **src-** this is the path where all data kept
        
    * **final\_back-** It**'**s set the name of the backup files
        
    * **tar -czvf -** used to create the backup
        
    
    Let's run the script and check the output:-
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679994868860/3271d193-a9a8-43d0-ab9c-b18090646251.png align="center")
    
    1. Create 2 users and just display their Usernames.
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679995712092/d192a858-c96a-48e7-87be-3885acd82088.png align="center")
        
        for displaying the name of the user you can use the below command
        
        **cat /etc/passwd**
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679995737558/66005140-d745-4787-b81e-40496a996bb8.png align="center")
        
        I hope this blog has helped you all to move towards the automation approach.
        
        Many more blogs are on the way for our DevOps Journey.
