forked from billstclair/cl-diceware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiceware
executable file
·35 lines (29 loc) · 1 KB
/
diceware
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
if ! [[ $1 == '' || $1 -gt 0 ]]; then
echo "Usage: diceware [<count>]"
echo " <count> defaults to 5."
echo " Picks <count> random words from the diceware list,"
echo " and prints them, separated by spaces."
exit
fi
# Tested in CCL & SBCL
# The LISP environment variable should be a command to start your lisp.
# If it contains "ccl" or "sbcl", proper command line options will be
# added to not print extraneous stuff.
# Otherwise, you can put those command line options in the LISP_OPTIONS
# environment variable.
# LISP defaults to "ccl".
if [ "x$LISP" = 'x' ]; then
LISP=ccl
fi
if [[ $LISP == *ccl* ]]; then
LISP_OPTIONS="--no-init --batch --quiet"
elif [[ $LISP == *sbcl* ]]; then
LISP_OPTIONS="--noinform --no-sysinit --no-userinit --noprint"
fi
FILE=$( readlink "${BASH_SOURCE[0]}" )
DIR=$( cd "$( dirname "$FILE" )" && pwd )
$LISP $LISP_OPTIONS \
--load $DIR/load-cl-diceware \
--eval "(format t \"~a~%\" (cl-diceware:random-words-string $1))" \
--eval "(quit)"