Created
September 4, 2019 21:26
-
-
Save jbenner-radham/af2925c618cbd4ece7bc7da1f57074ff to your computer and use it in GitHub Desktop.
Shell script to list only directories.
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
#!/usr/bin/env sh | |
lsdir () { | |
if [ "${1}" ]; then file=$1; else file='.'; fi | |
# shellcheck disable=SC2010 | |
ls -Al "${file}" | grep '^d' | awk '{print $NF}' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment