Dmi*_*sev 2 visual-studio-code
我想在点击F5终端时运行 bash 脚本并查看结果,就像我可以使用 python 脚本或其他脚本一样。我尝试这样做,Bash Debug但是即使我没有设置断点,它也会自动进入调试模式并在第一步停止。这是我使用的启动配置。
{
"type": "bashdb",
"request": "launch",
"name": "Run mysql test",
"cwd": "${workspaceFolder}",
"program": "/srv/gpf/dba/mysqlslap/run.sh",
"args": []
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何bash在调试模式下运行(根据您的示例,您似乎不需要这些功能),但您可以轻松地让脚本作为任务或构建选项运行。
将其放置在.vscode/tasks.json您的项目目录中
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run as Bash Script",
"type": "shell",
"command": "/bin/bash ${file}",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
您可以在"command"参数中放置任何您想要的内容。
正如您所看到的,它是一种类型"kind": "build",因此我可以点击ctrl+ shift+ B,这将在终端中执行。
请注意,您还可以使用命令面板(F1或ctrl++ shift)P并使用Task: Run as Task。
来源: https: //code.visualstudio.com/Docs/editor/tasks
| 归档时间: |
|
| 查看次数: |
14356 次 |
| 最近记录: |