2
0
Fork 0
mirror of https://github.com/alexanderepstein/Bash-Snippets synced 2018-11-08 02:59:35 +01:00

The file extension .png will be added only if the file has extensions other than .png or .PNG (#150)

This commit is contained in:
Aaditya Naik 2017-12-12 21:46:10 +05:30 committed by Alex Epstein
parent 103040f2fb
commit 228893ccbd
2 changed files with 10 additions and 1 deletions

View file

@ -87,9 +87,18 @@ makeqr()
# redirects the image obtained from the goqr api into a png file # redirects the image obtained from the goqr api into a png file
function makeQRFile { function makeQRFile {
input=$(echo "$input" | sed -e s/" "/%20/g -e s/'\\n'/%0A/g ) ##same as in the makeqr function input=$(echo "$input" | sed -e s/" "/%20/g -e s/'\\n'/%0A/g ) ##same as in the makeqr function
httpGet "api.qrserver.com/v1/create-qr-code/?size=150x150&data=$input" > $fileName.png
addFileExt
httpGet "api.qrserver.com/v1/create-qr-code/?size=150x150&data=$input" > $fileName
} }
function addFileExt {
if ! echo "$fileName" | grep -E -q ".*\.png$|.*\.PNG$"
then
fileName="$fileName.png"
fi
}
makeMultiLineQr() makeMultiLineQr()
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB