I'm currently writing a small script to backup bulks of floppy disks and format them afterward for later use.
dd to copy the disk's image and
cp to copy all the files on the disk.
Here are the commands I use to do so:
# Copying disk image dd if="/dev/fd0" of="/path/to/backup/folder" &>/dev/null && sync # Copying disk files cp -R "/mnt/floppy/." "/path/to/backup/folder/" &>/dev/null
After this process, the script needs to format the floppy disk. My problem is that I want my script to format the floppy disk only if both backup commands (
cp) were successful.
For example, if
dd couldn't copy all 1.44MB of the floppy disk because of bad blocks, then do not format the floppy disk.
How can I test if both commands were successful (They must be tested seperatly, as I do not always backup both disk's image and files)?