I want to redirect output of wget command to variable. WGET call needs user/pass authentication. I use /bin/sh not bash.
this is a part of my script:
Code:
/usr/bin/wget -O --http-user=$user --http-password=$pass "http://localhost:$port/json.htm?type=command¶m=getuservariable&idx=1"
and the result is creation of file named "--http-user=username" and output on screen like this:
Code:
--2017-07-22 20:08:35-- http://localhost:8855/json.htm?type=command¶m=getuservariable&idx=1
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8855... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Username/Password Authentication Failed.
But if I run the same command without "-O" parameter, it create file with correct result, so authentication was successful.
So, how can I place result of WGET to variable instead file with correct authentication?