Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Shell Studio PluginNew to Visual Studio Code? Get it now.
Shell Studio Plugin

Shell Studio Plugin

lupee

|
2 installs
| (0) | Free
Run .sh shell scripts in one click from the editor title bar: auto-save, shebang support, a dedicated terminal per script. 在编辑器标题栏一键运行 .sh 脚本:自动保存、识别 shebang、每个脚本一个专用终端
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Shell Studio Plugin - Run Shell Scripts in One Click / 一键运行 Shell 脚本

Open a .sh file in VS Code, click the run button in the editor title bar, and the script runs in the integrated terminal.

在 VS Code 里打开 .sh 文件,点一下编辑器右上角的运行按钮,脚本就在集成终端里运行。

English first, 中文说明在后半部分。

English

Usage

After installing, open any .sh file. A yellow play button appears in the editor title bar (top right); click it to run the current script.

You can also run Shell Studio: Run Shell Script from the Command Palette (Cmd/Ctrl + Shift + P).

The button and the command only appear for .sh files saved on disk, and the extension is case-insensitive (.sh and .SH both work). A new untitled file must be saved to disk first.

How scripts are run

  • Saves first: unsaved changes are saved automatically before running. If saving fails, the script is not run and a message is shown.
  • Interpreter: if the first line is a shebang (such as #!/bin/zsh or #!/usr/bin/env bash), the script runs with that interpreter. Otherwise the shellStudio.shellPath setting is used, bash by default. The script does not need execute permission.
  • Working directory: the script's own directory, so relative paths in the script resolve against its location.
  • Dedicated terminal: each script gets its own terminal named Run: <file name>. Running the same script again closes its previous terminal first and then runs it again; if the previous run has not finished (for example, a server it started), it is terminated. Terminals of different scripts do not affect each other.
  • Environment: the command runs in your default terminal shell (such as zsh), so PATH and environment variables set in .zshrc and similar files apply to the script.
  • Split editors: in a split layout, the button you click runs the script on that side, no matter which side has focus.
  • Special characters in paths: paths containing spaces, CJK characters, $, !, quotes and so on run correctly, and nothing in a path is ever executed as a command.

Settings

Setting Default Description
shellStudio.shellPath bash Interpreter for scripts without a shebang: a command name or a full path, such as /bin/zsh or /opt/homebrew/bin/bash. The interpreter only, without arguments. It can only be set in user settings; a project's .vscode/settings.json cannot override it, so opening someone else's project cannot swap it for an arbitrary command

Requirements

  • VS Code 1.75 or later
  • macOS and Linux. Windows PowerShell and cmd terminals use different quoting rules and are not supported yet

中文

使用方式

安装后打开任意 .sh 文件,编辑器右上角标题栏会出现一个黄色的播放按钮,点击即运行当前脚本。

也可以在命令面板(Cmd/Ctrl + Shift + P)中执行 Shell Studio: Run Shell Script。

按钮和命令只在打开磁盘上的 .sh 文件时出现,扩展名不区分大小写(.sh、.SH 都可以)。还没保存过的新文件需要先保存到磁盘。

运行规则

  • 先保存再运行:脚本有未保存的修改时,先自动保存再运行;保存失败则不运行,并弹出提示。
  • 解释器:脚本首行有 shebang(如 #!/bin/zsh、#!/usr/bin/env bash)时,用它指定的解释器运行;没有 shebang 时用配置项 shellStudio.shellPath,默认是 bash。脚本不需要执行权限。
  • 工作目录:脚本所在的目录,脚本里的相对路径以脚本自己的位置为准。
  • 专用终端:每个脚本有一个自己的终端,名为 Run: 文件名。再次运行同一个脚本时,会先关掉它上一次的终端再重新运行;如果上一次还没结束(例如启动了一个服务),会被直接结束。不同脚本的终端互不影响。
  • 运行环境:命令在你默认的终端 shell(如 zsh)里执行,.zshrc 等配置文件里设置的 PATH 和环境变量对脚本同样有效。
  • 分屏:左右分屏时,点哪一侧的按钮就运行哪一侧的脚本,与当前焦点在哪一侧无关。
  • 特殊路径:路径含空格、中文、$、!、引号等字符时都能正确运行,路径里的内容不会被当成命令执行。

配置项

配置 默认值 说明
shellStudio.shellPath bash 脚本没有 shebang 时使用的解释器,填命令名或完整路径,如 /bin/zsh、/opt/homebrew/bin/bash;只填解释器本身,不能带参数。只能在用户设置中修改,项目里的 .vscode/settings.json 不能覆盖它,避免打开别人的项目时被换成任意命令

系统要求

  • VS Code 1.75 及以上
  • macOS、Linux。Windows 上的 PowerShell、cmd 终端引号规则不同,暂不支持

Development / 开发

npm install
npm run compile   # compile / 编译
npm run package   # package as .vsix into release/ / 打包为 .vsix,输出到 release/

Local install / 本地安装: Extensions view ... → Install from VSIX... (扩展面板右上角 ... → 从 VSIX 安装), then choose the .vsix file under release/.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft