>_ IzzyLab

Topic breakdown

The idea is to build the archive name with today's date at run time rather than hardcoding it. date prints the date in the required format (check man date for the format directives), and to insert its output straight into the path string you use command substitution $( ): bash first runs the command, then substitutes the result. After that it's a matter of idempotently creating the directory (mkdir with the -p flag, which doesn't complain about an existing one) and packing the directory with the tar utility using flags for creating, gzip compression, and the filename.

What's checked

  1. backup-home is executable
  2. archive with today's date is created
  3. the archive is a valid tar.gz
  4. the archive holds the contents of /root

What it looks like