safe_set ignore leading white-space
Also treate ':' at the start of a line as for '#' ie. a comment.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
:
|
||||
# RCSid:
|
||||
# $Id: safe_eval.sh,v 1.26 2026/04/10 16:03:39 sjg Exp $
|
||||
# $Id: safe_eval.sh,v 1.27 2026/04/22 16:11:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2023-2026 Simon J. Gerraty
|
||||
#
|
||||
@@ -32,7 +32,7 @@ fi
|
||||
# "xtras" should be used with caution and cannot include ';'
|
||||
#
|
||||
safe_set() {
|
||||
${SED:-sed} 's/[ ]*#.*//;/^[A-Za-z_][A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. "'"$1"'$,/=:+-];_;g'
|
||||
${SED:-sed} 's/^[ ]*//;s/^[:#].*//;/^[A-Za-z_][A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. "'"$1"'$,/=:+-];_;g'
|
||||
}
|
||||
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user