DEV Community

Ebenezer Lamptey
Ebenezer Lamptey

Posted on

2

Saving Time: Batch QR Code Generation with Bash

Ever found yourself manually creating QR codes one by one? As a choir marketing committee member, I was frustrated with online tools that either:

  • Limit free users to one QR code
  • Charge for bulk generation
  • Waste precious time

The Frustration

Our choir needed QR codes for multiple YouTube links to print on marketing t-shirts. Existing solutions? Painfully slow and expensive.

The Bash Solution

I wrote a simple script to automate QR code generation:

bash

# Check if input file is provided
if [ -z "$1" ]; then
    echo "Usage: $0 <input_file>"
    exit 1
fi

input_file="$1"

# Create a directory to store QR codes
mkdir -p qr_codes

# Generate QR codes for each URL in the input file
while IFS= read -r url; do
    filename="qr_codes/$(basename "$url").png"
    qrencode -o "$filename" "$url"
    echo "Generated QR code for $url"
done < "$input_file"

echo "QR codes saved in 'qr_codes' directory."

Enter fullscreen mode Exit fullscreen mode

Key Benefits

  • Free
  • Fast
  • Customizable
  • No subscription needed

How It Works

  • Create a text file with URLs
  • Run the script
./qr_code.sh <text file>

Enter fullscreen mode Exit fullscreen mode

Get QR codes in seconds

Pro Tips

  • Use with qrencode
  • Works for any links, not just YouTube
  • Easily scriptable and modifiable

You can see the code in my github
https://github.com/nlankwei5/Create-Qr-code/blob/main/qr_code.sh

Feel free to try it and give comments for more improvements
No more manual, repetitive work. 🚀

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️