]> git.armaanb.net Git - bin.git/commitdiff
fortune: add -c and -l options
authorArmaan Bhojwani <me@armaanb.net>
Mon, 1 Mar 2021 05:45:15 +0000 (00:45 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 1 Mar 2021 05:45:15 +0000 (00:45 -0500)
fortune

diff --git a/fortune b/fortune
index 4868b1a65004cdbb69dda658951866b1cf333731..3c8529425df9112d94f5657a46b12a8f89fe6f15 100755 (executable)
--- 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