mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 21:54:08 +08:00

This splits a string into variables according to the shell's tokenization rules, considering quoting, escaping etc. This runs an automatic `unescape` on the string so it's presented like it would be passed to the command. E.g. printf '%s\n' a\ b returns the tokens printf %s\n a b It might be useful to add another mode "--tokenize-raw" that doesn't do that, but this seems to be the more useful of the two. Fixes #3823.
15 lines
185 B
Fish
15 lines
185 B
Fish
# RUN: %fish %s
|
|
echo 'a | b' | read -lt a b c
|
|
|
|
set -l
|
|
# CHECK: a a
|
|
# CHECK: b '|'
|
|
# CHECK: c b
|
|
|
|
echo 'a"foo bar"b' | read -lt a b c
|
|
|
|
set -l
|
|
# CHECK: a 'afoo barb'
|
|
# CHECK: b
|
|
# CHECK: c
|