diff options
Diffstat (limited to 'lessr')
-rwxr-xr-x | lessr | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +dir=$(dirname "$1") +base=$(basename "$1") + +if [ "$base" == "" ]; then + exit 3 +fi + +export LESSHISTFILE="$dir/.$base.hst" +touch $LESSHISTFILE || : + +# use a fallback dir if it's not writable +if [ ! -w "$LESSHISTFILE" ] +then + dir="$HOME/var/marks" + mkdir -p "$dir" + export LESSHISTFILE="$dir/.$base.hst" +fi + +# export LESS="-cix8JRM --save-marks" +exec less --save-marks "$@" |