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