Windows Bash and Visual Studio Code: How can I launch bash as a run task?

前端 未结 3 972
醉梦人生
醉梦人生 2020-12-16 03:00

how can I run the Windows Bash from Visual Studio code as a run task?

Here are some of my many attempts at tasks.json to do this.

{
           


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 03:51

    On my Windows 10 machine that has a freshly installed bash, this works fine for me:

    {
        "version": "0.1.0",
        "command": "bash",
        "isShellCommand": true,
        "args": [ "shellscript.sh" ],
        "showOutput": "always"
    }
    

    The shebang version of shellscript.sh as command doesn't work for me.

    You can also use bash -c "" to run an arbitrary command:

    {
        "version": "0.1.0",
        "command": "bash",
        "isShellCommand": true,
        "args": ["-c", "echo \"test\""],
        "showOutput": "always"
    }
    

提交回复
热议问题