Hello,
My question is about curl command. (ubuntu14.04)
In terminal, I am able to download my mainfile with:
curl -u user1:pass1 http://11.22.33.44/*******
When I convert it into bash script like this:
#!/bin/bash
cd /root/scripts
computer_ip=11.22.33.44
curl -u $1:$2 http://$computer_ip/****** > mainfile
#curl -u $1:$2 -O mainfile http://$computer_ip/****** #this is also not working
Having you tried running the script with the set -x ? What does that come back with?
What happens if you remove > mainfile ? What do you get?
Have you tried running curl in verbose ( -v ) mode?
Hello Vgersh99,
I do not know how to run with set -x
If I remove > mainfile how may I redirect the output to a file so that I would be able to manage some other tasks at following steps of the script, which were not mentioned in my post ? curl -v -u $1:$2 ****** is not giving an output.
#!/bin/bash
set -x
cd /root/scripts
computer_ip=11.22.33.44
curl -u $1:$2 http://$computer_ip/******
#curl -u $1:$2 -O mainfile http://$computer_ip/****** #this is also not working
Remove > mainfile for debugging purposes - once debugged, you can put it back in.
+ cd /root/scripts
+ computer_ip=****************
+ curl -u : 'http://*******************'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>401 Unauthorized</TITLE>
</HEAD><BODY>