Friday, 26 May 2023

Write a shell script to display system date in following format:

 Output :

 Today is September 24 2009

 Today is Thursday

 Time is in hh: mm: ss AM/PM


Code :


NOW=$(date +"%B %C %Y")

 echo "Today is" $NOW

 NNOW=$(date +"%A")

 echo "Today is" $NNOW

 TTIME=$(date +"%r")

 echo "Time is " $TTIME

Output :

$ sy1.sh

Today is March 01 2021

Today is Monday

Time is 10:44:12 AM

No comments:

Post a Comment