diff --git a/doc/reference/std/cli/shell.md b/doc/reference/std/cli/shell.md index 8947547ec..b3b61f296 100644 --- a/doc/reference/std/cli/shell.md +++ b/doc/reference/std/cli/shell.md @@ -3,7 +3,9 @@ The `:std/cli/shell` library provides facilities for working with Unix shell code ::: tip usage +```scheme (import :std/cli/shell) +``` ::: An earlier version of this library used to be available as `:clan/shell` @@ -25,7 +27,7 @@ All other ASCII characters may require the string to be quoted. For good measure we also quote strings containing non-ASCII characters. ::: tip Examples: -``` scheme +```scheme > (string-for-each (lambda (c) (or (easy-shell-character? c) (error "foo"))) "abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXZ012345678@%-_=+:,./") ;; no error > (string-for-each (lambda (c) (or (not (easy-shell-character? c)) (error "foo"))) @@ -43,7 +45,7 @@ The current implementation only trusts strings where every character satisfies `easy-shell-character?` to not require quoting. ::: tip Examples: -``` scheme +```scheme > (map needs-shell-escape ["foo?" "~user" "$1" "*.*" "!1" "ab\\cd" "{}" "a;b" "&" "|" "a b c"]) (#t #t #t #t #t #t #t #t #t #t #t) > (map needs-shell-escape ["foo" "%-_=+:,./" "1" "..." "abcd" "x=y:z,t.z/u+v_w"]) @@ -59,7 +61,7 @@ Given a `string`, returns a shell-escaped-string that, when included in a Unix shell command, will expand into the input `string`. ::: tip Examples: -``` scheme +```scheme > (map escape-shell-token ["foo?" "~user" "$1" "*.*" "!1" "ab\\cd" "{}" "a;b" "&" "|" "a b c"]) ("\"foo?\"" "\"~user\"" "\"\\$1\"" "\"*.*\"" "\"!1\"" "\"ab\\\\cd\"" "\"{}\"" "\"a;b\"" "\"&\"" "\"|\"" "\"a b c\"") > (let (l ["foo" "%-_=+:,./" "1" "..." "abcd" "x=y:z,t.z/u+v_w"]) @@ -68,7 +70,7 @@ when included in a Unix shell command, will expand into the input `string`. ``` ::: -### ->envvar +### ->envvar ```scheme (->envvar . str) => environment-variable-name ```