1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2026-04-19 00:54:06 +00:00

general: Escapes a string for safe use in parameter expansion

This commit is contained in:
Trey Keown
2026-03-20 15:51:15 -05:00
committed by Indrajit Raychaudhuri
parent 371aaa254a
commit 5464030f6a
8 changed files with 23 additions and 10 deletions

View File

@@ -0,0 +1,13 @@
#
# Escapes a string for safe use in ${(e)...} parameter expansion.
#
# Authors:
# Trey Keown <trey@crystalpeaksecurity.com>
#
# function escape-eval {
setopt LOCAL_OPTIONS EXTENDED_GLOB
print -r -- "${1//(#m)[\\\$\`]/\\$MATCH}"
# }