Table of Contents

About

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

Example

Format in ISO 8601

Format Instant - String 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)