shell script current time

#!/bin/bash
now="$(date)"
printf "Current date and time %s\n" "$now"
 
now="$(date +'%d/%m/%Y')"
printf "Current date in dd/mm/yyyy format %s\n" "$now"
 
echo "Starting backup at $now, please wait..."
# command to backup scripts goes here
# ...

3.9
10

                                    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}"

3.9 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
get current date and time in shell script linux shell script print current time linux shell get time and date get current time sh local time using shell script get current date time shell script get current time in linux shell how to see current time in bash print time in shell script time in shell script find current time in bash shell script echo time bash how to get current time how to get the time in shell script shell script get current time shell show time shell current time command current time shell script shell script ot get current date and time get time shell linux current time linux shell how to get time in shell get actual time shell how to print the current time in shell current time in bash get current time in bash print current time bash linux shell print current time currenttime shell script sh get current time getting the current time in bash script show time in seconds print current time + 2 hours in shell script print current hours in shell scripting GET CURRENT TIME INSQL kyvie current time current time bash convert time to seconds how to print the date in linux print current time in shell script Pascific time getting current time in bash bin bash generate current date how to print system time using shellscript shell echo time current time in linux shell how to print date using script linux print the date get date and time in bash script get currrent time bash bash current time linux script display date and time linux echo date time how to get current date with bash how to get time within bash script shell script date variable now Write a shell script to print current year shell script current tie shell script time shell script get time time in bash script get current day bash get current time in linux get current time linux shell current time using bash script print bash shell time linux bash show current date current day from date in linux echo time sh echo current itme echo time in shell script how to print date in linux bash use current date in string getting date using linux how to add current date in bash script how to print date and time and hours in shell script date time shell script bash get datetime bash script how to find by date echo currently time in bash bash script find date time in linux in bash script unix echo current time bash get dates linux bash how to show date time now bash Write a command to display the current date. how to get time and date in string linux get current date in shell linux shell get time echo current time print date linux shel how to get date in shell script print time bash how to get current time bash today's date shell print time bash\ bash get time bash get date time on a script bash get date on a script shell echo curent time shell print curent time shell script now time how to get local time in shell script how to get time in shell script how to get timestamp in shell script get current time in shell script bash now time shell script example to print the current date and time bash get date current time bash get current dste in linux cmd Write a shell script to get current date print current time shell current date in linux bash print current time how to fetch date and time in shell bash get current time linux get date command current time function in shell script bash datetime now to string shell script date time bash get date and time display today date time in shell display today date in shell shell script to get current time assign current date to a variable bash script shell get current time bash get current date and time today date in shell script shell script current time
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source