summaryrefslogtreecommitdiffstats
path: root/catc
blob: b13ba7e6ecd5836bff8eef29645c658f546da7cf (plain)
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