summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-08-03 17:34:44 +0200
committerxengineering <me@xengineering.eu>2022-08-03 17:34:44 +0200
commit49f3bfce56f7ba1e8447ce6cf4229f8f2cbb2e19 (patch)
treef97ad2cacb6a2fa4ce07bf78f5a699a48ece77d2
parentc461fdc783c0094b766a36095d1b12d54f93a57e (diff)
downloadscripts-49f3bfce56f7ba1e8447ce6cf4229f8f2cbb2e19.tar
scripts-49f3bfce56f7ba1e8447ce6cf4229f8f2cbb2e19.tar.zst
scripts-49f3bfce56f7ba1e8447ce6cf4229f8f2cbb2e19.zip
Add url.sh
-rwxr-xr-xurl.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/url.sh b/url.sh
new file mode 100755
index 0000000..e198399
--- /dev/null
+++ b/url.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# vim: shiftwidth=4 tabstop=4 noexpandtab
+
+# constants
+data_repo="${HOME}/.local/share/mydata"
+data_rel="tables/urls.tsv"
+data_abs="${data_repo}/${data_rel}"
+
+# check if data file exists
+if ! [ -f "${data_abs}" ]
+then
+ echo "Data file '""${data_abs}""' not found."
+ exit 1
+fi
+
+# check dependency and warn user if necessary
+if ! which bemenu > /dev/null 2>&1
+then
+ echo 'You have to install bemenu.'
+ exit 1
+fi
+
+# check dependency and warn user if necessary
+if ! which firefox > /dev/null 2>&1
+then
+ echo 'You have to install firefox.'
+ exit 1
+fi
+
+# let user select the URL
+line="$(bemenu -l 10 < "${data_abs}")"
+url="$(echo "${line}" | awk -F '\t' '{print $1}')"
+
+firefox "${url}"