changeset 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 ffbbcc65bbe2
children 370b7ed2da1d
files bin/random-card
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bin/random-card	Sun May 15 23:21:02 2016 +0000
+++ b/bin/random-card	Mon May 16 11:14:18 2016 +0000
@@ -1,2 +1,2 @@
 #!/bin/sh
-exec perl -e'open$I,"<","share/mtg/allsets.txt"or die$!;$/=""; @c=grep{/(?mi:$ARGV[0])/}<$I>; print $c[rand(@c)];' "$1"
+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"