[Nix-dev] How to escape $'\t' in Nix multi-line string?

Bjørn Forsman bjorn.forsman at gmail.com
Sun Apr 30 20:04:06 CEST 2017


On 30 April 2017 at 19:53, Profpatsch <mail at profpatsch.de> wrote:
> On 17-04-30 03:07pm, Bjørn Forsman wrote:
>> On 30 April 2017 at 15:01, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>> > Hi all,
>> >
>> > I'm stuck trying to pass $'\t' to bash via Nix multi-line strings:
>> >
>> > nix-repl> ''cut -d $'\t' -f 1''
>> > error: syntax error, unexpected $undefined, expecting IND_STR or
>> > DOLLAR_CURLY or IND_STRING_CLOSE, at (string):1:10
>>
>> Oh, it was only missing double single-quotes before the dollar sign.
>>
>> What tripped me was that the documentation says ${ is special in
>> strings, not $'.
>
> How should we improve the manual in this regard?

Sure. But I'm also quite interested in knowing why $' needs escaping,
especially when $ ' (space between) does not.

- Bjørn


More information about the nix-dev mailing list