How to see current date, time, username, and current directory using shell script in Unix?

How to see current date, time, username, and current directory using shell script ?

Senior Developer Asked on December 7, 2017 in LINUX.
Add Comment
1 Answer(s)
    
    #!/bin/bash
    
    echo "Current Date:"
    
    date
    
    echo "Username:"
    
    whoami
    
    echo "Current direcotry:"
    
    pwd
    
    

     

    Output:

     

    
    Current Date:
    
    Wed Dec 27 17:53:27 UTC 2017
    
    Username:
    
    root
    
    Current direcotry:
    
    /home
    
    
    Team Leader Answered on December 27, 2017.
    Add Comment

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.