annotate paste/paste.6763 @ 12257:1924fe176291 draft

<fizzie> ` sed -e \'s|wisdom|bin|\' < ../bin/cwlprits > ../bin/cblprits; chmod a+x ../bin/cblprits
author HackEso <hackeso@esolangs.org>
date Sat, 07 Dec 2019 23:36:53 +0000
parents 84da026b16a5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1381
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
1 #!/bin/sh
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
2 cd /var/irclogs/_esoteric
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
3
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
4 pasterandom() {
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
5 if [ "$1" -gt 150 ]; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
6 echo "No."
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
7 exit
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
8 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
9 for i in $(seq "$1"); do
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
10 file=$(shuf -en 1 ????-??-??.txt)
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
11 echo "$file:$(shuf -n 1 $file)"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
12 done | paste
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
13 }
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
14
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
15 if [ "$1" ]; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
16 if expr "$1" + 0 >/dev/null 2>&1; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
17 pasterandom "$1"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
18 else
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
19 lines=$(grep -P -i -- "$1" ????-??-??.txt | head -n 301)
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
20 {
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
21 echo "$lines" | head -n 300
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
22 [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
23 } | paste
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
24 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
25 else
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
26 pasterandom 40
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
27 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
28