Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,26 @@ platform-independent scripts, we recommend you go with that.

However, `shx` is ideal for one-liners inside `package.json`:

```javascript
```json
{
"scripts": {
"clean": "shx rm -rf build dist && shx echo Done"
"clean": "shx rm -rf \"build/**/*.js\" \"build/output\" && shx echo \"Done cleaning\""
}
}
```

**Tip:** because Windows treats single quotes (ex. `'some string'`) differently
than double quotes, [we
recommend](https://github.com/shelljs/shx/issues/165#issuecomment-563127983)
wrapping your arguments in double quotes for cross platform compatibility (ex.
`"some string"`).
It's safe to use `&&` and `||` operators in npm package scripts. These will be
interpreted by the operating system's shell (`sh` on Unix, `cmd.exe` on
Windows). If you're using glob operators like `*` or `**`, then we recommend to
**put these in double quotes**, which ensures that `shx` will expand the glob
rather than the operating system shell.

> [!IMPORTANT]
> Windows treats single quotes (ex. `'some string'`) differently than double
> quotes.
> [We recommend](https://github.com/shelljs/shx/issues/165#issuecomment-563127983)
> wrapping your arguments in **escaped double quotes** so that your code is
> compatible cross platform (ex. `"clean": "shx echo \"some string\""`).

## Command reference

Expand Down