lib shell.escape: escape the empty string as ''
This commit is contained in:
parent
3416a45b54
commit
8179f87e5a
@ -7,10 +7,13 @@ rec {
|
||||
let
|
||||
isSafeChar = testString "[-+./0-9:=A-Z_a-z]";
|
||||
in
|
||||
stringAsChars (c:
|
||||
if isSafeChar c then c
|
||||
else if c == "\n" then "'\n'"
|
||||
else "\\${c}");
|
||||
x:
|
||||
if x == "" then "''"
|
||||
else stringAsChars (c:
|
||||
if isSafeChar c then c
|
||||
else if c == "\n" then "'\n'"
|
||||
else "\\${c}"
|
||||
) x;
|
||||
|
||||
#
|
||||
# shell script generators
|
||||
|
Loading…
Reference in New Issue
Block a user