Answers for "get date from shell script"

3

today's date shell script

#!/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
# ...
Posted by: Guest on August-18-2020
0

string to date in shell script

date -d '20121212 7 days'
date -d '12-DEC-2012 7 days'
date -d '2012-12-12 7 days'
date -d '2012-12-12 4:10:10PM 7 days'
date -d '2012-12-12 16:10:55 7 days'
Posted by: Guest on December-29-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language