什么是 Windows bash 模拟 Linux sh 文件下载器?
我尝试将 Linux 安装脚本移植到 Windows。在脚本中,我有文件下载,例如
ASL_DISTRO_SITE=surfnet.dl.sourceforge.net
BOOST_NAME=boost_1_44_0
BOOST_VERSION=1.44.0
if [ ! -e $BOOST_DISTRO_NAME ]; then
echo_run ${CURL_CMD} http://$ASL_DISTRO_SITE/project/boost/boost/$BOOST_VERSION/$BOOST_DISTRO_NAME -o $BOOST_DISTRO_NAME
fi
如何将脚本的这部分移植到 windows .bat 语言?默认情况下有来自 MS 的实用程序吗?
I try porting linux setup script to windows. In script I have file download like
ASL_DISTRO_SITE=surfnet.dl.sourceforge.net
BOOST_NAME=boost_1_44_0
BOOST_VERSION=1.44.0
if [ ! -e $BOOST_DISTRO_NAME ]; then
echo_run ${CURL_CMD} http://$ASL_DISTRO_SITE/project/boost/boost/$BOOST_VERSION/$BOOST_DISTRO_NAME -o $BOOST_DISTRO_NAME
fi
How to port such part of script to windows .bat language? Are there any utils coming from MS by default?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您提供的代码中似乎缺少一些项目,但这是如何继续的最佳猜测:
我没有简单的方法来测试它,所以如果它不起作用,请删除打开和关闭括号和延续字符“^”,并将所有
%CURL_CMD% ...
命令与if NOT EXISTS ...
放在同一行。因此,您需要提供 BOOST_BASE_DIR 的值(我已将其作为 var 添加到脚本中)、BOOST_DISTRO_NAME、CURL_CMD ....并且...您需要确定是否需要
echo_run
,我不这么认为。对于echo_run
,您必须查看原始脚本。我猜想这是一个定义的函数,并且使用了eval
。如果这是真的,上面的方法可能行不通。创建一个不带 IF NOT 测试的 bat 文件,但包含所有set ...
变量和%CURL_CMD%
,运行该文件,然后添加上面的问题未能解决您的问题;-)我希望这会有所帮助。
There seem to be a couple of missing items in the code you provide, but here is a best guess of how to proceed:
I don't have an easy way to test this, so if it doesn't work, remove the open and close parens and the continuation char '^', and put all of the
%CURL_CMD% ...
command on the same line as theif NOT EXISTS ...
.So, you need to provide values for BOOST_BASE_DIR (which I have added as a var to the script), BOOST_DISTRO_NAME, CURL_CMD .... AND ... you need to find out if you need
echo_run
, I don't think so. Forecho_run
, you have to look at your original script. I would guess that this is a function defined, and that is uses theeval
. If that is true, the above may not work. Make a bat file without the IF NOT test, but with the all theset ...
variables, and the%CURL_CMD%
, run it and then add the output of the failure to you question above ;-)I hope this helps.
从此处下载 Windows 版 cURL
Download cURL for Windows from here