vscode task.json shell脚本不适用于参数

时间:2019-07-08 10:09:24

标签: shell visual-studio-code

我无法将参数传递给Task中的Shell脚本。

我在Ubuntu 18.04中使用VSCode 1.36.0。 task.json版本2.0.0

tasks.json文件中有一个简单的任务:

{             “ label”:“跨部署_2”,             “ type”:“ shell”,             “选项”:{                 “ cwd”:“ / home / $ {env:USERNAME} / osr-renesas /”             },             “ command”:“。./cross-deploy_2.sh”,             “ problemMatcher”:[                 “ $ gcc”             ]         }

这是脚本 cross-deploy_2.sh

ip=$1
execution_file=$2
echo $ip
echo $execution_file
. sources/poky/oe-init-build-env
devtool build glv-get-started

我需要从源代码运行它以保存环境变量。因此,在上一个示例中,我没有看到 echo ,但该脚本可以正常运行。

如果我添加 args ,就像这样

{
        "label": "cross-deploy_2",
        "type": "shell",
        "options": {
            "cwd": "/home/${env:USERNAME}/osr-renesas/"
        },
        "command": ". ./cross-deploy_2.sh",
        "args": [
            "10.15.11.1",
            "glv-get-started",
        ],
        "problemMatcher": [
            "$gcc" 
        ]
    },

任务无效。这是终端的输出

> Executing task: '. ./cross-deploy_2.sh' 10.15.11.1 glv-get-started <

/bin/bash: . ./cross-deploy_2.sh: No such file or directory
The terminal process command '/bin/bash -c ''. ./cross-deploy_2.sh' 
10.15.11.1 glv-get-started'' failed to launch (exit code: 127)

Terminal will be reused by tasks, press any key to close it.

请帮助我运行带有参数的脚本 提前谢谢

0 个答案:

没有答案