scripts/misc/autoless

15 lines
188 B
Plaintext
Raw Normal View History

2019-09-30 12:49:14 +00:00
#!/bin/zsh
if [[ -n "$@" ]]; then
out=$(<"$@")
else
out=$(cat)
fi
((lim=$LINES-1))
numlines=$(echo $out | wc -l)
if (( $numlines > $lim ))
then
echo $out | less -R
else
echo $out
fi