Last active
December 15, 2015 12:39
-
-
Save artem-bez/d2a7dc2b15a7239c1be9 to your computer and use it in GitHub Desktop.
After changing working directory print directory listing if terminal is big enough to fit it, otherwise print $MOST_RECENT_LEN recently modified entries.
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
| MOST_RECENT_LEN=20 | |
| function chpwd { | |
| if [[ $(ls --format=vertical -w ${COLUMNS} | wc -l) -lt $((LINES - 1)) ]] { | |
| ls | |
| } else { | |
| echo $(find . -maxdepth 1 | wc -l) entries. \ | |
| Showing $MOST_RECENT_LEN most recent \(ctime\) | |
| ls -c | head -n$MOST_RECENT_LEN | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment