Last active
May 7, 2019 02:29
-
-
Save o0-o/41f461dc6e863e6f189100acbd562349 to your computer and use it in GitHub Desktop.
[Disks] Prints disks #Shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# disks.sh | |
( # linux | |
lsblk --all --noheadings --list --output NAME,TYPE | | |
grep disk | | |
sed 's/[[:space:]]disk//g' || | |
# bsd | |
geom disk list | | |
grep "Geom name: " | | |
awk '{ print $NF }' | | |
grep --invert-match "cd" || | |
# macos | |
diskutil list | | |
grep "^/dev/disk" | | |
grep "physical" | | |
sed 's/\/dev\///g' | | |
awk '{ print $1 }' | |
) 2>/dev/null || | |
exit 1 #failure | |
exit 0 #success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment