I want to automate a backup using dd in a bash script.
I currently use this command to create a backup image of my sda2 partition:
sudo dd bs=64K if=/dev/sda2 | gzip > /mnt/backup/backup_sda2_**TODAY**.img.gz
I want to parameterise a bash script with a variable TODAY- where TODAY is the current DAY OF THE MONTH – so, for example 4th April 2021 will be 4
So my questions are:
1.How do I create the variable TODAY using system date?
2.How do I build it into the dd command above?