Skip to content

Instantly share code, notes, and snippets.

@kb10uy
Created December 19, 2015 17:43
Show Gist options
  • Save kb10uy/b4fddbc42d30f5e8edb8 to your computer and use it in GitHub Desktop.
Save kb10uy/b4fddbc42d30f5e8edb8 to your computer and use it in GitHub Desktop.
lsのrwxを8進表示にするシェル関数です
function lsn() {
ls $* --color=always \
| sed -e 's/^-/f/g' \
| sed -e 's/--x/1/g' \
| sed -e 's/-w-/2/g' \
| sed -e 's/-wx/3/g' \
| sed -e 's/r--/4/g' \
| sed -e 's/r-x/5/g' \
| sed -e 's/rw-/6/g' \
| sed -e 's/rwx/7/g' \
| sed -e 's/---/0/g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment