fish-shell/tests/checks/read.fish
Fabian Homborg 86133b0a2b Add read --tokenize
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.
2019-12-01 18:14:26 +01:00

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