Created
February 2, 2019 11:55
-
-
Save Trucido/75bbaafdf7b6dfbe9aaca1e0a61e5b34 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
| if [ -n "${BASH-}${ZSH_NAME-}" ]; then | |
| lsw () { | |
| [ -n "$1" ] && command -v which >/dev/null 2>&1 && ( | |
| for f in $(command -p which -a "$@" 2>/dev/null); do { | |
| [ -n "$f" ] && { | |
| command -p ls -alhFNT0 --color "$f" | gawk '{ | |
| k = 0; | |
| for (i = 0; i <= 8; i++) | |
| k += ((substr($1, i + 2, 1) ~ /[rwx]/) *2^ (8 - i)); | |
| if (k) | |
| printf(" %0o ", k); | |
| }' | |
| } | |
| } | |
| done | |
| ) | column -t | sort -hr | |
| } | |
| fi | |
| lsw "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment