if [ "$?" != "0" ]; then
echo "Skipping copy of ${output} to ${device}..."
else
+ # Check if device exists
+ if [ ! -e "${device}" ]; then
+ echo "Error: device \"${device}\" does not exist."
+ echo "Skipping copy of ${output} to ${device}..."
# Check if device is mounted
- if [ "`mount | grep ${device}`" != "" ]; then
+ elif [ "`mount | grep ${device}`" != "" ]; then
echo "Error: device \"${device}\" is mounted."
echo "Skipping copy of ${output} to ${device}..."
else