Variables in wget post data

I am working on a simple bash script to download images from the website Tumblr. The idea is to use read to get login info from the user, and wget --post-data to log in, and this is what I have:

read -p "Tumblr login email: " EMAIL
read -p "Tumblr login password: " PASSWRD
wget --user-agent=Mozilla/5.0 --save-cookies cookies.txt --post-data 'email=$EMAIL&password=$PASSWRD' --no-check-certificate https://www.tumblr.com/login

However, it is sending "$EMAIL" and "$PASSWRD" instead of the strings for the variables, is there any way to get it to send values that have been inputted by the user?

Answers


change:

--post-data 'email=$EMAIL&password=$PASSWRD'

to:

--post-data="email=$EMAIL&password=$PASSWRD"

bash manual about Quoting: http://www.gnu.org/software/bash/manual/bashref.html#Quoting


important: Do not use :

--header="Content-Type: text/xml" 

together with --post-data. It will override

--header="Content-Type: application/x-www-form-urlencoded" 

issued by wget. Post-data will not be received by HttpServlet


Need Your Help

Can't get Mongoose virtuals to be part of the result object

virtual mongoose

bI'm declaring a virtual that I want to appear as part of the results of its schema's queries, but it's not showing up when I do a console.log on the object. Here's the schema:

Swift "Bridging-Header.h" file not allowing me to instantiate objective-c classes in .swift files

ios objective-c xcode swift xcode6

When X-code tries to create a bridging header automatically, it crashes every single time, so I followed the instructions on how to manually create a bridging header.