-
-
Save slumos/d9abdb6adfabbfeb6be6375c9fa54527 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
| function l { | |
| if [[ ! -t 0 ]]; then | |
| # stdin is not connected to a tty | |
| pager - | |
| elif [[ $# -eq 1 && -f "$1" ]]; then | |
| # single argument names a file | |
| pager "$1" | |
| else | |
| ls -CFL $* | |
| fi | |
| } |
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
| function pager { | |
| case "$1" in | |
| *asc) | |
| gpg -dq "$1" | pager - | |
| clear | |
| ;; | |
| *bz|*bz2) | |
| LESSOPEN='|bzip2 -cdq -- %s' "$PAGER" "$1" | |
| ;; | |
| *gz) | |
| LESSOPEN='|gzip -cdq -- %s' "$PAGER" "$1" | |
| ;; | |
| *pdf|*png|*jpg) | |
| ql "$1" | |
| ;; | |
| *xz) | |
| LESSOPEN='|xz -cdq -- %s' "$PAGER" "$1" | |
| ;; | |
| *) | |
| "$PAGER" "$1" | |
| ;; | |
| esac | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment