Add an open command
authorColin P. McCabe <cmccabe@apache.org>
Sun, 29 Dec 2024 22:28:16 +0000 (14:28 -0800)
committerColin P. McCabe <cmccabe@apache.org>
Sun, 29 Dec 2024 22:29:07 +0000 (14:29 -0800)
open [new file with mode: 0755]

diff --git a/open b/open
new file mode 100755 (executable)
index 0000000..dd6be3d
--- /dev/null
+++ b/open
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+for f in "$@"; do
+    lowercased=`echo "$f" | sed 's/./\L&/g'`
+    case $lowercased in
+        *.pdf) 
+            setsid nohup evince "${f}" > /dev/null 2> /dev/null;; 
+        *)
+            setsid nohup xdg-open "${f}" > /dev/null 2> /dev/null;; 
+    esac
+done