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