before i begin i am aware this may be an issue best opened on git-hub but;
a. it's minor
b. the functionality of the backslash has already been outlined by a previously closed issue but not the white-space (see here)
c. i am unable to open issues on git-hub, being a new user
d. it may help newcomers via google-indexing.
Feel free to create a git-hub issue on my behalf.
Consider the following code;
# Our fish :)
set fishies \
">('>" \
"><=*>" \
">-<==*>" \
">==(--v-*);->" \
"><>" \
"><(((º>" \
">-<===*>" \
">(̠̄:̠̄ >" \
">><((( ◉ >"
# Usage ; set fish (getfish) && echo $fish
function getfish
# Set our fish to a random item from the "fishies" list
set -l fish $fishies[(random 1 (count $fishies))]
# Return our fish to the STDOUT
echo $fish
end
This works fine. However, if we are to introduce a white-space after any backslash ("\__" (indicated by the underscore (_))) the line below it will not be passed to the set fishes
command.
Is this a correct behavior and is their any documentation on how the backslash works as I've only stumbled this through tinkering?
To re-iterate, can anyone explain to me why this behavior occurs?
The most i found (i think) in reference to the back-slash is the following code on the git-hub issue aforementioned (i don't fully understand it however);
It (the usage of a backslash to form a new-line) has been special cased in tokenizer.cpp:539 :
if ((*(tok->buff) == L'\\') &&(*(tok->buff+1) == L'\n'))
{
tok->last_pos = tok->buff - tok->orig_buff;
tok->buff+=2;
tok->last_type = TOK_END;
return;
}
Apologies if this is naive / poorly written i am a new and in-active user. I thought I'd throw my 2 cents in and hopefully help any other newcomers encountering this same issue, it's a great little feature and a lush little tool, it would be a shame to leave this behavior undocumented as it comes in handy when writing long commands/strings.
\
(backslash space) escapes the space character. This keeps the shell from splitting arguments on the escaped space." it seems they have already documented this behaviour for another purpose, so I'd thnk it's unlikely they'll change it.