Azure批处理-在Linux VM上从命令行运行多个命令 [英] Azure batch - run multiple commands from command line on linux VM

查看:71
本文介绍了Azure批处理-在Linux VM上从命令行运行多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一开始,我使用以下配置创建了一个池:

At the beginning, I created a pool with the following configuration:


Publisher: microsoft-ads

"Publisher": "microsoft-ads"

提供: linux-data-science-vm

"Offer": "linux-data-science-vm"

Sku: linuxdsvm

"Sku": "linuxdsvm"

然后我要复制 start.sh文件并在VM上运行。
因此,我需要更改权限,以允许执行start.sh,然后再执行它。

Then I want "start.sh" file to be copied and run on VM. So, I need to change permissions, to allow execution of start.sh and then execute it.

chmod +x start.sh && ./start.sh

当我从终端手动运行时,它可以工作。
但是Azure Batch在stderr.txt中写入以下内容:

When I run it manually from terminal it works. But Azure Batch writes the following in the stderr.txt:


chmod:无法访问'&&':否这样的文件或目录

chmod: cannot access '&&': No such file or directory

是否可以通过单个命令行运行多个命令?

Is there some way to run multiple commands from single Command Line?

推荐答案

您应使用 / bin / bash -c 启动命令,然后将命令放在双引号中,例如这个:
/ bin / bash -c chmod + x start.sh&& ./ start.sh

You should start the command with /bin/bash -cand then put the command in double quotes, like this: /bin/bash -c "chmod +x start.sh && ./start.sh"

这篇关于Azure批处理-在Linux VM上从命令行运行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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