Automation, Orchestration, and Scripting

A script runs the following: file=backup-2024-06-15.tar.gz [[ $file =~ ^backup-([0-9]{4})-([0-9]{2})-([0-9]{2}) ]] echo "${BASH_REMATCH[2]}" What does the echo command print?

Show the answer

Correct answerC. 06

After a successful =~ match, BASH_REMATCH[n] holds the nth parenthesized group, so index 2 is the second group, the month 06. Index 0 would hold the entire matched text, and index 1 would hold the year.