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:
committed by
Indrajit Raychaudhuri
parent
371aaa254a
commit
5464030f6a
13
modules/helper/functions/escape-eval
Normal file
13
modules/helper/functions/escape-eval
Normal 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}"
|
||||
|
||||
# }
|
||||
Reference in New Issue
Block a user