]> gitweb.fluxo.info Git - scripts.git/commitdiff
Feat: add basic show script
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 3 Sep 2020 20:44:42 +0000 (17:44 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 3 Sep 2020 20:44:42 +0000 (17:44 -0300)
show [new file with mode: 0755]

diff --git a/show b/show
new file mode 100755 (executable)
index 0000000..b822af5
--- /dev/null
+++ b/show
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# View a document.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+DOCS="$HOME/data/doc"
+ITEM="$1"
+
+# Check
+if [ -z "$ITEM" ]; then
+  echo "usage: $BASENAME <item-name>"
+  exit 1
+fi
+
+# Dispatch
+find $DOCS -iname "*$ITEM*" | head -1 | while read item; do xdg-open "$item"; done