Skip to content

Instantly share code, notes, and snippets.

@danixland
Created June 18, 2013 09:43
Show Gist options
  • Save danixland/5804060 to your computer and use it in GitHub Desktop.
Save danixland/5804060 to your computer and use it in GitHub Desktop.
qrencoder.sh - a little bash script that uses libqrencode by Fukuchi Kentaro to build a QR Code with your infos libqrencode - http://fukuchi.org/works/qrencode/ - https://github.com/fukuchi/libqrencode
#!/bin/bash
# qrencoder.sh - qrencoder.sh - a little bash script that uses libqrencode to build a QR Code with your infos
# libqrencode by Fukuchi Kentaro
# http://fukuchi.org/works/qrencode/ - official website
# https://github.com/fukuchi/libqrencode - development version on github
if [[ ! -z $1 ]];then
INPUTFILE=$1
else
INPUTFILE='/tmp/input.txt'
if [ -f $INPUTFILE ];then
rm $INPUTFILE
fi
clear
echo -n "Insert your name: "
read name
if [[ ! -z $name ]]; then
echo my name is $name > $INPUTFILE
fi
echo -n "Insert your phone number: "
read phone
if [[ ! -z $phone ]]; then
echo "call me: $phone" >> $INPUTFILE
fi
echo -n "Insert your e-mail address: "
read email
if [[ ! -z $email ]]; then
echo "write me: $email" >> $INPUTFILE
fi
echo -n "Insert your web site: "
read web
if [[ ! -z $web ]]; then
echo "read me: $web" >> $INPUTFILE
fi
fi
echo -n "How should I call the output file? (don't insert the file extension): "
read output
# the file is created as a 300dpi PNG blue on white
cat $INPUTFILE | qrencode -s 10 -d 300 --foreground=3D55A5 --background=FFFFFF -o ~/$output.png
echo "Your QR Code is in your home and is called $output.png"
rm $INPUTFILE
exit
# $0 written under the effect of Pink Floyd's The Great Gig in the Sky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment