Which is calling echo with two strings. The first is 'quote test x'
which is single quote delimited and therefore echoes without quotes. The string is only quote delimited if it starts with a quote. After that is a second string thisisatest'x', since it doesn’t start with a quote they’re just interpreted as characters. If you want to echo x'thisisatest'x then you can either remove the quotes at the start and end or use two single quotes which is the escape sequence for quotes.
Hi Maxxus, I also find “‘quoting’” an obstacle to overcome in kakoune.
Take the below data structure when you break it apart you’ll find that the entire structure falls over on just omitting a \n character. It’s fragile as well as being complex.
A community member Guest0x0 github repository handles a wide range of “‘quoting’” in alternate ways. This helped me gain a deeper understanding on the topic and some new ideas on tackling future problems.
@Maxxus: did you know that in this case you could just use eval %sh{..} instead of nop %sh{.. | kak -p $kak_session}? Then you don’t need to specify the client again. It would look like this:
I see the mistake now, thank you. It’s when the string is passed back to kakoune for echo. It falls back to kakoune quoting rules. In kakoune echo, is a space automatically inserted between two strings that are butted together?
I’m actually modifying and existing kak script, so I don’t want to change the structure if I can help it. But I will keep in mind the eval vs nop difference in the future.
Kakoune’s quoting uses different rules than the shell. The biggest difference is that Kakoune escapes quote characters by doubling, rather than with backslashes, but also Kakoune only cares about quotes at the beginning of a space-delimited word, or after the end of another quoted string, not in the middle of a word.