Last active
December 22, 2022 05:20
-
-
Save mikemilla/7adaec9fab247499687d01b498722a1a to your computer and use it in GitHub Desktop.
Script to generate local mac IP as a QR code
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 | |
# Check if qrencode is installed | |
if ! [ -x "$(command -v qrencode)" ]; then | |
# Install qrencode if it is not installed | |
brew install qrencode | |
fi | |
# Find the local IP address of the Mac | |
ip_address=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}') | |
# Modify the IP address to include ":3000" at the end | |
modified_ip_address="$ip_address:3000" | |
# Add "http://" to the front of the modified IP address | |
url="http://$modified_ip_address" | |
# Use the qrencode command to generate a QR code for the URL | |
qrencode -o - -t UTF8 "$url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment