Are you able to write a Bash script that will download an HTTP resource from the web?
The inputs are:
$hostname
$port
$path
$output
You can't:
- use external commands other than
telnet
(no sed, no awk, no wget, ...) - use other shells
You can:
- use
/dev/tcp
pseudo devices - use
telnet
Your MUST pass this test (you can change the input if you want, I don't receive anything if you visit me):
hostname=andreafrancia.it # use what you want instead of this
port=80
path=/bash-http-contest.txt
./your-script "$hostname" "$port" "$path" output.actual
wget http://"$hostname:$port/$path" -O output.expected
diff --binary output.actual output.expected # this should return 0 i.e. they are equals.
You MUST explicitly state that your code snippet uses one of these licenses: GPL (v1,v2,v3), or Apache License or that is in public domain or use some other license that allow someone else reuse your script.
You MUST put your code in the stackoverflow page (no external links or attached file).
The first win. The date that counts is the last edit date.