Skip to content

Commit

Permalink
Add example of reading script from stdin using echo (#6567)
Browse files Browse the repository at this point in the history
As a non-shell-wizard, I was unfamiliar with the `EOF` syntax used in
the existing example (just above the one I added). I thought including
an example where the output of `echo` is piped to `uv run` might be more
accessible. As a bonus, it should work across more shells: the `EOF`
example doesn't work in fish because fish [doesn't support
heredocs](https://fishshell.com/docs/current/fish_for_bash_users.html#heredocs),
while the `echo` example does.

Feel free to ignore if unwanted.
  • Loading branch information
skykasko authored Aug 24, 2024
1 parent f783524 commit 8ca64de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/guides/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ hello world!

Additionally, your script can be read directly from stdin:

```console
$ echo 'print("hello world!")' | uv run -
```

Or, if your shell supports [here-documents](https://en.wikipedia.org/wiki/Here_document):

```bash
uv run - <<EOF
print("hello world!")
Expand Down

0 comments on commit 8ca64de

Please sign in to comment.