From e06b7c831ac07a505ae02a4d9958c41e9afc0786 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Mon, 1 Mar 2021 00:45:15 -0500 Subject: [PATCH] fortune: add -c and -l options --- fortune | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fortune b/fortune index 4868b1a..3c85294 100755 --- a/fortune +++ b/fortune @@ -5,8 +5,10 @@ usage() { echo "fortune -- a simple awk/POSIX sh implementation of fortune" echo "" - echo "\t-h --help show this help message" - echo "\t--file=\$FILE specify path to cookie file" + echo "\t-h, --help show this help message" + echo "\t-l, --list=\$FILE list installed cookie files" + echo "\t-f=\$FILE, --file=\$FILE specify path to cookie file" + echo "\t-c=\$FILE, --cookie=\$FILE specify cookie file" } FILE="$(find /usr/share/fortune/ -type f -not -name '*.dat')" @@ -21,6 +23,13 @@ while [ "$1" != "" ]; do -f | --file) FILE=$VALUE ;; + -c | --cookie) + FILE=/usr/share/fortune/$VALUE + ;; + -l | --list) + ls -1 /usr/share/fortune + exit + ;; *) echo "ERROR: unknown parameter \"$PARAM\"" usage -- 2.39.2