Trang Esther
New member
How do I print the current date and time in Linux?
Answer
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 # …
Answer
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 # …