shell.md
This file
Path
docs/shell.md
38 lines · 1.2 KiB · Markdown
Last changed by
Add user guides (#989)ehmickybefore adoptionbe91ecf
History of this fileTake it
shell.md
💻 Shell
Avoiding shells
In general, shells should be avoided because they are:
- Not cross-platform, encouraging shell-specific syntax.
- Slower, because of the additional shell interpretation.
- Unsafe, potentially allowing command injection (see the escaping section).
Specific shell
import {execa} from 'execa';
await execa({shell: '/bin/bash'})`npm run "$TASK" && npm run test`;
OS-specific shell
When the shell option is true, sh is used on Unix and cmd.exe is used on Windows.
sh and cmd.exe syntaxes are very different. Therefore, this is usually not useful.
await execa({shell: true})`npm run build`;
Next: 📜 Scripts
Previous: 💬 Escaping/quoting
Top: Table of contents