diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2026-04-22 16:15:13 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2026-04-22 16:15:13 +0000 |
| commit | 69cc351c4c911cfeda1851f3c18a4b61281708cb (patch) | |
| tree | 41c645553e7a9553e853bdafeba959fded45a399 | |
| parent | 51b65c6af2e19f1e944c67aa2b5252cd9dc9e2f7 (diff) | |
safe_set ignore leading white-space
Also treate ':' at the start of a line as for '#'
ie. a comment.
| -rw-r--r-- | libexec/rc/safe_eval.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/rc/safe_eval.sh b/libexec/rc/safe_eval.sh index e12b17c787d2..f96c34dda936 100644 --- a/libexec/rc/safe_eval.sh +++ b/libexec/rc/safe_eval.sh @@ -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' } ## |
