Skip to content

Instantly share code, notes, and snippets.

@NeilHanlon
Created February 23, 2017 21:17
Show Gist options
  • Save NeilHanlon/65992006e97a718f2f8246efb16c3646 to your computer and use it in GitHub Desktop.
Save NeilHanlon/65992006e97a718f2f8246efb16c3646 to your computer and use it in GitHub Desktop.
#!/bin/bash
baddisks=()
for disk in "/" "/disk2" "/disk3" ; do
if [[ -d ${disk} ]]; then
touch ${disk}/test 2>/dev/null || baddisks+=(${disk})
rm ${disk}/test 2>/dev/null
fi
done
count="${#baddisks[@]}"
if (( ${count} > 0 )); then
echo "${baddisks[@]}"
exit ${count}
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment