How to use the date / time variable in Bash?

Bash Liste Des Attaques Ovh

How to use the date / time variable in Bash?

About

This page is about the management of time variable in Bash.

Example

Format in ISO 8601

Format Iso 8601

date -u +"%Y-%m-%dT%H:%M:%SZ"

Date to file name

mv OPatch OPatch.bkp_$(date -u +"%Y-%m-%d.%H:%M")

# or
date -u +"%Y-%m-%d_%H.%M.%S"

Comparison

Conditional Double Bracket example

[[ $(date) =~ ^Fri\ ...\ 13 ]] && echo "It's Friday the 13th!"

Comparison

Name Double Bracket operator Single Bracket Operator
RegularExpression matching =~ (not available)







Share this page:
Follow us:
Task Runner