Takes a random quote from a file and prints it. The fortunes should be separeted by the line: !!\n (well. this is probably the millionth time this script is made, speak of reinventing the wheel:) Have fun (o:
perl -e'while(<>){$a.=$_;}@b=split/!!\n/,$a;print$b[int rand@b];' \ /my/quotefile

Replies are listed 'Best First'.
RE: Random fortune one-liner
by btrott (Parson) on Mar 30, 2000 at 12:05 UTC
    Umm, I don't believe you want the "-n" in there, as that inserts a loop around your entire script body that makes your particular script not work. See perlrun. Without it the script seems to work just fine.
      ok. thanks! Thats why the script never went out of the loop. (Notice the exit; at the end) It works though.