Mercurial > repo
view bin/random-card @ 8072:90dbd630fd23
<b_jonas> `` perl -pi -e \'s/ (\\$c\\[rand\\(\\@c\\)])/($1 || "No card found.")/\' bin/random-card
author | HackBot |
---|---|
date | Mon, 16 May 2016 11:14:18 +0000 |
parents | a4a897101bb9 |
children | 8934300cd6d1 |
line wrap: on
line source
#!/bin/sh exec perl -e'open$I,"<","share/mtg/allsets.txt"or die$!;$/=""; @c=grep{/(?mi:$ARGV[0])/}<$I>; print($c[rand(@c)] || "No card found.");' "$1"