From: Oleg Broytman Date: Sat, 12 Mar 2016 21:57:11 +0000 (+0300) Subject: .profile: verify that `less' exists X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=146c62e58aa974d6c2f7012de21a59d5535834eb;p=dotfiles.git .profile: verify that `less' exists Set PAGER to `more' if `less' doesn't exist. --- diff --git a/.profile b/.profile index d4b94b0..965af56 100644 --- a/.profile +++ b/.profile @@ -60,18 +60,22 @@ if [ -t 0 ] ; then stty sane erase ^H + if [ -n "`which less 2>/dev/null`" ]; then + HAS_LESS=true + fi + case "$TERM" in linux) # mutt, python and vim BACKGROUND=DARK export BACKGROUND - . "$HOME"/lib/config/less/dark_bg + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg ;; *rxvt*|screen*|*term*|vt100) BACKGROUND=LIGHT export BACKGROUND - . "$HOME"/lib/config/less/light_bg + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg ;; esac @@ -79,18 +83,24 @@ if [ -t 0 ] ; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" fi - PAGER=less - LESS="FRXgimq" - case "$LC_CTYPE" in - *UTF-8) LESSCHARSET=utf-8 - ;; + if [ -n "$HAS_LESS" ]; then + PAGER=less + LESS="FRXgimq" + case "$LC_CTYPE" in + *UTF-8) LESSCHARSET=utf-8 + ;; - *) LESSCHARSET=koi8-r - ;; - esac - #LESSCHARDEF=32c. - LESSEDIT='vim ?lt+%lt. -- %f' - export PAGER LESS LESSCHARSET LESSEDIT # LESSCHARDEF + *) LESSCHARSET=koi8-r + ;; + esac + #LESSCHARDEF=32c. + LESSEDIT='vim ?lt+%lt. -- %f' + export LESS LESSCHARSET LESSEDIT # LESSCHARDEF + + else + PAGER=more + fi + export PAGER EDITOR="$HOME"/.vim/vim.sh VISUAL="$EDITOR" @@ -204,7 +214,7 @@ if [ -n "$DISPLAY" ]; then # mutt, python and vim BACKGROUND=LIGHT export BACKGROUND - . "$HOME"/lib/config/less/light_bg + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg # BROWSERs BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER" @@ -234,6 +244,8 @@ if [ -n "$DISPLAY" ]; then #export __GL_FSAA_MODE fi +[ -n "$HAS_LESS" ] && unset HAS_LESS + # # read in usepkg function # . "$HOME"/lib/config/usepkg.sh