Azure 批处理 - 运行 来自 linux VM 命令行的多个命令

Azure batch - run multiple commands from command line on linux VM

一开始,我创建了一个配置如下的池:

"Publisher": "microsoft-ads"

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

"Sku": "linuxdsvm"

然后我想在 VM 上复制 "start.sh" 文件和 运行。 所以,我需要更改权限,允许执行 start.sh 然后执行它。

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

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

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

有什么方法可以从单个命令行 运行 执行多个命令吗?

您应该以 /bin/bash -c 开始命令,然后将命令放在双引号中,如下所示: /bin/bash -c "chmod +x start.sh && ./start.sh"