bash - 如何使用 Windows cmd 行中的 vboxmanage cli 将参数传递给 shell/bash 脚本?
问题描述
我有一个在 Oracle Virtual box 中运行的 VM。在这个 VM 中,我有一些 bash/shell 脚本,并且还定义了一些全局变量,例如export abc=123
vm中的脚本,
#!/bin/bash
echo testing
echo $abc
在 vm 中,如果我使用我运行此脚本,则bash test.sh
输出为
testing
123
如果我从 windows 命令提示符下运行命令,我会得到testing
输出,但我没有得到123
. 我只是在输出中得到一个空格。我的 vboxmanage 命令如何获取在我的 vm.xml 中abc
定义的变量的值。
testing
windows cli中的命令,
VBoxManage guestcontrol vm-name run /bin/sh --exe "test.sh" --username user --password pass --verbose --wait-stdout --wait-stderr
解决方案
推荐阅读
- javascript - 使用 JS 在 PDF 上绘制形状
- python - ValueError:传递的 save_path 不是有效的检查点:modeltest.ckpt
- amazon-web-services - Kubernetes AWS 上的艰难之路 - 部署和配置 cloud-controller-manager
- angular - 选择标签不适用于 Ionic Framework 中的 Android chrome
- curl - 通过 curl 命令在 Keyclock 上创建用户
- r - 使用 grepl 匹配具有一个特定数字的名称
- d3.js - 如何将 URL 添加到气泡图?
- java - 背景和按钮问题
- javascript - 向 bpmn-js 查看器添加颜色
- javascript - 在 Javascript 中复制 mcrypt_encrypt