Closed milahu closed 2 months ago
im starting to notice a pattern... : P
aah! nevermind, im an idiot ^^ i got confused by the repl, which shows quoted strings...
nix-repl> lib.escapeShellArg (builtins.concatStringsSep "\n" [ "a" "b" ]) == "'a\nb'"
true
for special characters like newlines
actual
expected: prefix the '...' strings with $ to $'...' strings because 'a\nb' != $'a\nb'
How does the leading dollar sign affect single quotes in Bash?
ANSI-C Quoting (Bash manual)
What does it mean to have a $"dollarsign-prefixed string" in a script?
similar but different issue shellAliases are not properly escaped (also escapeShellArg does not handle newlines) nixpkgs#25143
similar but different issue Need help understanding how to escape special characters in the list of str type
python shlex does it wrong, too...
javascript shlex does it wrong, too... (https://github.com/rgov/node-shlex/issues/27)
im starting to notice a pattern... : P
when all are doing it "wrong" then its probably safe to always prepend a
$
dollar sign to the resultbut wait:
https://github.com/rgov/node-shlex
but this affects only shlex.split