|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Capture http response code from wget
Hi All,
I am using wget to call a url..i am getting 202 if it is successful. if not i am forcing the response code to 417. how can i capture the response code and print 0 if it is 202 and 1 if it is not 202 any ideas, please share Thanks, Jack. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
(($?==202)) will return 0 if $? is 202
|
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
You'll want the
--server-response option, eg Code:
wget --server-response http://localhost/nx.file 2>&1 | awk '/^ HTTP/{print $2}' |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using WGET or CURL to HTTP Post with Authentication | krypton | Shell Programming and Scripting | 2 | 02-26-2010 11:51 AM |
| Capture RSA fingerprint from ssh response | chorlton | Shell Programming and Scripting | 0 | 04-10-2009 07:00 AM |
| cant make a http get request using wget | elthox | UNIX for Dummies Questions & Answers | 1 | 02-20-2009 01:49 PM |
| Response Code using wget in shell | rajbal | Shell Programming and Scripting | 2 | 09-28-2006 03:39 AM |
| wget using wildcards using http | hcclnoodles | Shell Programming and Scripting | 2 | 04-13-2005 10:50 AM |
|
|