aboutsummaryrefslogtreecommitdiff
path: root/base/qr
diff options
context:
space:
mode:
authorAdam Hovorka <[email protected]>2020-06-16 17:37:29 -0600
committerAdam Hovorka <[email protected]>2020-06-16 17:37:29 -0600
commit93e0e434a54ae616a8a4649b3ae8bdc54e34b556 (patch)
tree74822cd8c059211f0e3adaa7910c74d2cfe45d5a /base/qr
parent20bbb154467e63ce6fbae48c13fac9d3fba95587 (diff)
Upgrade qr into a script that encodes and decodes
Diffstat (limited to 'base/qr')
-rwxr-xr-xbase/qr12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/qr b/base/qr
new file mode 100755
index 0000000..2de2dc9
--- /dev/null
+++ b/base/qr
@@ -0,0 +1,12 @@
+#!/bin/bash
+if [[ -f "$1" ]]; then
+ if file -bi "$1" | grep "^image/" &>/dev/null; then
+ OUTPUT="$(zbarimg -q "$1" | grep "^QR-Code:")"
+ if [[ $? -eq 0 ]]; then
+ echo "$OUTPUT" | tail -c+9
+ exit
+ fi
+ fi
+fi
+
+qrencode -t UTF8 $@