OS X:相当于Linux的wget [英] OS X: equivalent of Linux's wget

查看:85
本文介绍了OS X:相当于Linux的wget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在普通OS X系统上从Un * x shell脚本中进行HTTP GET? (不能选择安装第三方软件,因为它必须在我无法控制的许多不同系统上运行.)

How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different systems which I don't have control on).

例如,如果我在本地启动Mercurial服务器进行 hg服务:

For example if I start the Mercurial server locally doing a hg serve:

... $ hg serve 

然后,从具有 wget 命令的Linux中,我执行wget:

And then, from a Linux that has the wget command I do a wget:

... $  wget http://127.0.0.1:8000
--2010-12-31 22:18:25--  http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [text/html]
Saving to: `index.html

在我启动"hg serve" 命令的终端上,我确实可以看到HTTP GET成功实现了

And on the terminal in which I launched the "hg serve" command, I can indeed see that an HTTP GET made its way:

127.0.0.1 - - [30/Dec/2010 22:18:17] "GET / HTTP/1.0" 200 -

因此,在Linux上,从Shell脚本执行HTTP GET的一种方法是使用 wget (如果已安装该命令).

So on Linux one way to do an HTTP GET from a shell script is to use wget (if that command is installed of course).

还有什么其他方法可以实现 wget 的功能?我特别希望能在OS X的现有安装中使用某些东西.

What other ways are there to do the equivalent of a wget? I'm looking, in particular, for something that would work on stock OS X installs.

推荐答案

我不得不说curl http://127.0.0.1:8000 -o outfile

这篇关于OS X:相当于Linux的wget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆