Created
April 20, 2015 17:22
-
-
Save tjluoma/139877856de1955b6946 to your computer and use it in GitHub Desktop.
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
| #!/bin/zsh -f | |
| # Purpose: Show the number of mounted devices (not including boot drive) | |
| # Intended to be used with TextBar - http://www.richsomerfield.com/apps/ | |
| COUNT=`/sbin/mount | /usr/bin/egrep -v '^(devfs|map) ' | /usr/bin/wc -l | /usr/bin/tr -dc '[0-9]'` | |
| # We don't want to count the boot drive, so subtract 1 | |
| COUNT=$(($COUNT - 1)) | |
| if [ "$COUNT" = "0" ] | |
| then | |
| echo -n "No Mounts" | |
| elif [ "$COUNT" = "1" ] | |
| then | |
| echo -n "1 Mount" | |
| else | |
| echo -n "$COUNT Mounts" | |
| fi | |
| exit 0 | |
| # | |
| # | |
| # From: Tj Luo.ma | |
| # Mail: luomat at gmail dot com | |
| # Web: http://RhymesWithDiploma.com | |
| # Date: 2015-04-18 | |
| #EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment