1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/zsh #set -x # Part of pipe if [[ ! -t 0 ]];then exit fi # Source of Pipe if [[ ! -t 1 ]];then #echo "Test" /bin/cat [email protected] exit fi columns=${$(stty size)[1]} lines=${$(wc -l $1)[1]} if [[ $columns -gt $lines ]];then /bin/cat [email protected] else /bin/less [email protected] fi #set +x