strings.subr (250702) | strings.subr (251272) |
---|---|
1if [ ! "$_STRINGS_SUBR" ]; then _STRINGS_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_STRINGS_SUBR" ]; then _STRINGS_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/strings.subr 250702 2013-05-16 16:51:52Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/strings.subr 251272 2013-06-02 23:08:21Z dteske $ |
28# 29############################################################ GLOBALS 30 31# 32# Valid characters that can appear in an sh(1) variable name 33# 34# Please note that the character ranges A-Z and a-z should be avoided because 35# these can include accent characters (which are not valid in a variable name). --- 212 unchanged lines hidden (view full) --- 248# Escape $string for shell eval statement(s) by replacing all single-quotes 249# with a special sequence that creates a compound string when interpolated 250# by eval with surrounding single-quotes. 251# 252# For example: 253# 254# foo="abc'123" 255# f_shell_escape "$foo" bar # bar=[abc'\''123] | 28# 29############################################################ GLOBALS 30 31# 32# Valid characters that can appear in an sh(1) variable name 33# 34# Please note that the character ranges A-Z and a-z should be avoided because 35# these can include accent characters (which are not valid in a variable name). --- 212 unchanged lines hidden (view full) --- 248# Escape $string for shell eval statement(s) by replacing all single-quotes 249# with a special sequence that creates a compound string when interpolated 250# by eval with surrounding single-quotes. 251# 252# For example: 253# 254# foo="abc'123" 255# f_shell_escape "$foo" bar # bar=[abc'\''123] |
256# eval echo \'$foo\' # produces abc'123 | 256# eval echo \'$bar\' # produces abc'123 |
257# 258# This is helpful when processing an argument list that has to retain its 259# escaped structure for later evaluations. 260# 261# WARNING: Surrounding single-quotes are not added; this is the responsibility 262# of the code passing the escaped values to eval (which also aids readability). 263# 264f_shell_escape() --- 27 unchanged lines hidden --- | 257# 258# This is helpful when processing an argument list that has to retain its 259# escaped structure for later evaluations. 260# 261# WARNING: Surrounding single-quotes are not added; this is the responsibility 262# of the code passing the escaped values to eval (which also aids readability). 263# 264f_shell_escape() --- 27 unchanged lines hidden --- |