Created
July 11, 2020 01:35
-
-
Save luismrsilva/c6ff8f95e2187e239449e3a745ac5907 to your computer and use it in GitHub Desktop.
Generate Wifi QR on terminal after asking for SSID and PASSWORD
This file contains hidden or 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
#!/bin/bash | |
# Generate Wifi QR on terminal after asking for SSID and PASSWORD | |
# 2020-07-11 luismrsilva | |
# Show SVG (needs X) | |
# qrencode -t svg -o /dev/fd/1 -s 10 | display /dev/fd/0 | |
# Show on terminal | |
# qrencode -t ANSI | |
read -p "SSID: " SSID | |
read -p "PASS: " PASS | |
read -p "Hidden? (Y/N) " -n 1 -r IS_HIDDEN | |
echo | |
if [[ $IS_HIDDEN =~ ^[Yy]$ ]]; then | |
HIDDEN="H:true;" | |
else | |
HIDDEN="" | |
fi | |
echo "Assuming WPA auth." | |
# https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 | |
echo "WIFI:S:${SSID};T:WPA;P:\"${PASS}\";${HIDDEN}" | qrencode -t ANSI | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment