time in bash script code example
Example 1: shell script current time
date +'FORMAT'
### mm/dd/yyyy ###
date +'%m/%d/%Y'
## Time in 12 hr format ###
date +'%r'
## backup dir format ##
backup_dir=$(date +'%m/%d/%Y')
echo "Backup dir for today: /nas04/backups/${backup_dir}"
Example 2: bash time
date #displays date and time in terminal
Example 3: bash time command
time [command] #measures time required by following command. For example:
time ls