Variable parsing with Bash and wget
Posted
by
Bill Westrup
on Super User
See other posts from Super User
or by Bill Westrup
Published on 2012-09-30T01:54:27Z
Indexed on
2012/09/30
3:40 UTC
Read the original article
Hit count: 602
I'm attempting to use wget in a simple bash script to grab a jpeg image from an Axis camera. This script outputs a file named JPEGOUT, instead of the desired output, which should be a timestamp jpeg (ex: 201209292040.jpg) . Changing the variable in the wget statement from JPEGOUT to $JPEGOUT makes wget fail with "wget: missing URL" error.
The weird thing is wget parses the $IP vairable correctly. No luck on the output file name. I've tried single quotes, double quotes, parenthesis: all to no luck.
Here's the script
!/bin/bash
IP=$1
JPEGOUT= date +%Y%m%d%H%M.jpg
wget -O JPEGOUT http://$IP/axis-cgi/jpg/image.cgi?resolution=640x480&compression=25
Any ideas on how to get the output file name to parse correctly?
© Super User or respective owner