Created
September 9, 2024 20:36
-
-
Save vguhesan/6d1cb2abe7d1c085de232d7bc40c291f to your computer and use it in GitHub Desktop.
Generate qrcode of a url and display it in an Edge browser on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# qrc.sh | |
# Generate qrcode of a url and display it in an Edge browser on Windows | |
# This script depends on https://github.com/skip2/go-qrcode | |
# Debug Options | |
# Toggle the echo variable assignment to either ":" (nop) or "echo" | |
echo=":" | |
# echo="echo" | |
ext="png" | |
if [[ $# -eq 0 ]]; then | |
echo 'Usage: qrc "url"' | |
exit 0 | |
fi | |
# If we get here "last" argument should be defined | |
last=${@: -1} | |
$echo "Last argument: $last" | |
# set me to a place suitable on your system | |
mkdir -p /c/tmp | |
current_time=$(date "+%Y.%m.%d-%H.%M.%S") | |
$echo "Current Time: $current_time" | |
filename="qrc-$current_time.png" | |
$echo "$filename" | |
fullpathtofile="/c/tmp/$filename" | |
$echo "$fullpathtofile" | |
# Generate the grcode png | |
qrcode "$last" > $fullpathtofile && start msedge $fullpathtofile && sleep 10 && rm $fullpathtofile | |
echo "$fullpathtofile has been removed" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment