Mercurial > repo
comparison bin/pastelog @ 2257:5c453217583b
<Jafet> sed -i... -e \'s/grep/timeout 25 grep/\' bin/pastelog
author | HackBot |
---|---|
date | Tue, 26 Feb 2013 18:01:53 +0000 |
parents | e037173e0012 |
children | be90d778a82d |
comparison
equal
deleted
inserted
replaced
2256:b2cc3747ec36 | 2257:5c453217583b |
---|---|
14 | 14 |
15 if [ "$1" ]; then | 15 if [ "$1" ]; then |
16 if expr "$1" + 0 >/dev/null 2>&1; then | 16 if expr "$1" + 0 >/dev/null 2>&1; then |
17 pasterandom "$1" | 17 pasterandom "$1" |
18 else | 18 else |
19 lines=$(grep -P -i -- "$1" ????-??-??.txt | head -n 301) | 19 lines=$(timeout 25 grep -P -i -- "$1" ????-??-??.txt | head -n 301) |
20 { | 20 { |
21 echo "$lines" | head -n 300 | 21 echo "$lines" | head -n 300 |
22 [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]" | 22 [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]" |
23 } | paste | 23 } | paste |
24 fi | 24 fi |