From 8ca64de67ed18fd5b8632811265fcc5c2ff02884 Mon Sep 17 00:00:00 2001 From: skykasko <88055150+skykasko@users.noreply.github.com> Date: Sat, 24 Aug 2024 01:03:59 -0400 Subject: [PATCH] Add example of reading script from stdin using echo (#6567) 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. --- docs/guides/scripts.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md index df3df074e..1c9318801 100644 --- a/docs/guides/scripts.md +++ b/docs/guides/scripts.md @@ -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 - <