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

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


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

I've looked at https://nixos.org/nix/manual/#ssec-values but I don't
see how to fix this case.

If I add a space between $ and ' the error goes away, that's as close
to a "solution" as I've got. (Why does Nix care about the
two-character sequence $'?) Another "solution" is to change the outer
"double single quotes" into "single quotes". But that's not what I
want, because it causes issues with the rest of the script (not shown
here).

Best regards,
Bjørn Forsman


More information about the nix-dev mailing list