How Do I Get the Current Day in Unix?
Contents How Do I Get the Current Date in Unix? Sample Shell Script to Display the Current Date and Time #! /Bin/Bash Now=”$(Date)” Printf “Current Date and...
Contents
How do I get the current date in Unix?
Sample shell script to display the current date and time
#!/bin/bash now=”$(date)” printf “Current date and time %sn” “$now” now=”$(date +’%d/%m/%Y’)” printf “Current date in dd/mm/yyyy format %sn” “$now” echo “Starting backup at $now, please wait…” # command to backup scripts goes here # …
Must Read
What is the date format in Unix?
Below is a list of common date format options with examples output. It works with the Linux date command line and the mac/Unix date command line.
…
Bash date format options.
| Date Format Option | Meaning | Example Output |
|---|---|---|
| date +%m-%d-%Y | MM-DD-YYYY date format | 05-09-2020 |
| date +%D | MM/DD/YY date format | 05/09/20 |