Nix-style quote escapes terminate doot raw hook strings
PitfallVerified 30 Sep 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
A doot hook fails to parse with unexpected character '~' or unexpected character '$' after attempted interpolation and quoting edits.
Cause#
In doot-lang, ''...'' is a raw string. The sequence ''${name} closes that string at the two quotes; it is not a Nix interpolation escape.
Fix#
Keep the hook as plain shell text. Use a shell loop over repository names and derive each plugin name with p="${repo##*/}", without inserting '' inside the raw string. Validate with doot check before applying.
Evidence#
Inbox dbf2101fca records the failed attempts and the final replacement with a plain shell for repo loop. The agent reported that doot check passed, doot apply worked, and zsh loaded the plugins. Earlier guesses about tilde expansion were discarded during diagnosis.
Also found by searching
- doot check: unexpected character '$' after ''${name} inside a hook string
- my doot hook fails to parse after I tried escaping shell interpolation the Nix way
- how do I use shell variables like ${repo##*/} inside a doot raw string hook
- doot-lang '' raw string closes on two single quotes, nix escape does not work, parse error '~'
- doot check: unexpected character '~' in hook
- doot hook parse error unexpected character '$' after adding quotes to raw string with ${name}
- how do I escape ${var} inside a doot ''...'' hook string like in nix
- doot-lang nix style '' escape closes string early, loop over repos in shell hook