I'm currently writing a small script to backup bulks of floppy disks and format them afterward for later use.I 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 imagedd if=/dev/fd0 of=/path/to/backup/folder &>/dev/null && sync# Copying disk filescp -R /mnt/floppy/. /path/to/backup/folder/ &>/dev/nullAfter 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 (dd and 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)? 
Check command success in bash
bash;shell script;dd;cp