From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/netifrc:master commit in: sh/
Date: Sun, 21 Apr 2019 04:17:55 +0000 (UTC) [thread overview]
Message-ID: <1555820151.1076ace3242611cb6d125f3d18700d363e16be57.robbat2@OpenRC> (raw)
commit: 1076ace3242611cb6d125f3d18700d363e16be57
Author: Martin Väth <martin <AT> mvath <DOT> de>
AuthorDate: Fri Aug 17 11:11:45 2018 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 04:15:51 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1076ace3
sh/functions.sh: Avoid bashisms in shell_var()
POSIX shells do not provide a substitution operation ${..//..}
Negated character classes are marked by [!..] and not [^..] in POSIX.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
sh/functions.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sh/functions.sh b/sh/functions.sh
index 5895a90..832e58e 100644
--- a/sh/functions.sh
+++ b/sh/functions.sh
@@ -36,7 +36,15 @@ if [ "$INIT" != "openrc" ]; then
shell_var() {
local output= sanitized_arg=
for arg; do
- sanitized_arg="${arg//[^a-zA-Z0-9_]/_}"
+ sanitized_arg=$arg
+ while :; do
+ case $sanitized_arg in
+ *[!a-zA-Z0-9_]*)
+ sanitized_arg=${sanitized_arg%%[!a-zA-Z0-9_]*}_${sanitized_arg#*[!a-zA-Z0-9_]}
+ continue;;
+ esac
+ break
+ done
if [ x"$output" = x"" ] ; then
output=$sanitized_arg
else
next reply other threads:[~2019-04-21 4:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-21 4:17 Robin H. Johnson [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-03-25 0:45 [gentoo-commits] proj/netifrc:master commit in: sh/ Patrick McLean
2019-04-21 5:34 Robin H. Johnson
2016-10-24 22:26 Robin H. Johnson
2016-07-19 19:59 Robin H. Johnson
2015-01-22 23:01 Robin H. Johnson
2015-01-16 18:16 Robin H. Johnson
2015-01-16 18:16 Robin H. Johnson
2015-01-09 17:17 Robin H. Johnson
2015-01-09 17:17 Robin H. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1555820151.1076ace3242611cb6d125f3d18700d363e16be57.robbat2@OpenRC \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox