wget或类似程序在POSIX系统上是否始终可用? [英] Is wget or similar programs always available on POSIX systems?

查看:61
本文介绍了wget或类似程序在POSIX系统上是否始终可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在默认情况下在POSIX或* nix操作系统中分发的HTTP客户端(如 wget/lynx/GET )以实现最大的可移植性?

Is there an HTTP client like wget/lynx/GET that is distributed by default in POSIX or *nix operating systems that could be used for maximum portability?

我知道大多数系统都安装了 wget lynx ,但是我似乎还记得使用默认设置安装了一些Ubuntu服务器系统,而它们都没有 wget lynx .

I know most systems have wget or lynx installed, but I seem to remember installing some Ubuntu server systems using default settings and they had neither wget or lynx installed in the base package.

我正在编写Linux(可能是Mac)的Shell脚本,以在计算机上安装软件.为了避免分发几个大文件,我想从互联网上获取这些文件,而不是与安装程序打包在一起.当前,安装脚本将分发到一个由 Makeself 创建的文件中.

I am writing a shell script for Linux (and probably Mac) to install a piece of software onto the computer. To prevent having to distribute a couple of large files, I would like to fetch these files from the internet instead of packaging in with the installer. Currently, the install script is to be distributed in a single file created from Makeself.

我想避免安装脚本超过100 MB(如果包含文件的话)会超过100 MB,而且如果此人正在升级或重新安装软件,则可能不需要这些脚本.也许最便携的方法是将文件包含在pacakage中.

I'd like to avoid having the install script be over 100 MB which it would be if the files were included, and also they may not be required if the person is upgrading or re-installing the software. Maybe the most portable thing to do is include the files in the pacakage.

现在,我只是想让脚本按此顺序检查 wget lynx GET ,它将使用无论哪种方式都可以下载,但是如果可以下载可以在所有系统上运行的文件,我可以完全避免这种情况.

Right now I am just thinking of having the script check for wget, lynx, and GET, in that order and it will use whichever one it can for downloading, but I could avoid this altogether if there was a way I could download the files that would work on all systems.

有人对lwp-request( GET )及其可用性了解很多吗?到目前为止,我在已经检查过的几个系统上似乎都可以使用该功能,而且我记得,距今已有10多年的历史了,可以追溯到RedHat.

Does anyone know much about lwp-request (GET) and its availability? This seems to be readily available on several of the systems I have checked so far, and I remember this always being around 10+ years ago going back to RedHat.

推荐答案

在2019-11-04中进行我正在重写我的答案,以反映确保在飞行中不要篡改传输的重要性.我将原始答案保留在规则之下.

Edit in 2019-11-04: I'm rewriting my answer to reflect the importance of ensuring that a transfer isn't tampered with while in flight. I'll leave my original answer below the rule.

我建议在 ssh 上使用 rsync 来传输文件. rsync 的界面可能看起来不堪重负,但是大多数用户可能可以选择 rsync -avzP ,并且如果您需要更多的灵活性,rsync可以适应.使用 ssh 将为您的连接提供完整性,真实性和私密性.

I suggest using rsync over ssh to transfer your files. rsync's interface may look overwhelming, but most users may be able to pick rsync -avzP, and if you need more flexibility, rsync can adapt. Using ssh will provide integrity, authenticity, and privacy to your connection.

curl 是HTTP传输的事实上的标准;如果首选纯HTTP或https,则 curl 或基于 curl 的工具可能是一个不错的选择.

curl is the de facto standard for http transfers; if plain http or https are preferred, curl or tools based on curl are probably a good choice.

根据我的经验,工具按以下顺序可用:

In my experience, tools are available about in this order:

  • wget
  • 卷曲
  • sftp
  • ftp
  • GET (我一直使用 HEAD ,常常忘记它只是套件中的一种工具)
  • tftp
  • nc (不如我所愿)
  • socat (甚至更少见)
  • wget
  • curl
  • sftp
  • ftp
  • GET (I use HEAD all the time and often forget it is just one tool in the suite)
  • tftp
  • nc (not as common as I wish)
  • socat (even less common)

bash /dev/tcp 工具在我使用过的大多数系统上都可用(某些使用过的 dash pdksh ),但是将 echo bash nc socat -用于HTTP访问的方法-您必须以某种方式处理标头 ,这会降低其美观程度.

The bash /dev/tcp tool is available on most systems I've used (some used dash or pdksh instead), but using echo with bash, nc, or socat is going the long-way-around for HTTP access -- you'll have to handle headers somehow, which reduces its elegance.

这篇关于wget或类似程序在POSIX系统上是否始终可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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