From 607eab1151031f4de53133b924e7a3a79b9bbefc Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 13 Sep 2010 16:34:38 -0400 Subject: [PATCH] Use sed instead of expr to split a flag from its argument. Fixes a problem with expr interpreting its arguments as a flag when they start with a dash. --- install-sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/install-sh b/install-sh index 7a207e2d5..79e7f4081 100755 --- a/install-sh +++ b/install-sh @@ -71,7 +71,7 @@ while ${MORETODO} ; do ;; X-b*) BACKIT=true - BACKUP=`expr "$1" : '-b\(.*\)'` + BACKUP="`echo \"$1\" | sed 's/^..//'`" ;; X-c) # backwards compatibility @@ -85,7 +85,7 @@ while ${MORETODO} ; do shift ;; X-g*) - GROUP=`expr "$1" : '-g\(.*\)'` + GROUP="`echo \"$1\" | sed 's/^..//'`" CHGROUPIT=true ;; X-G) @@ -95,7 +95,7 @@ while ${MORETODO} ; do ;; X-G*) if ${ROOT} ; then - GROUP=`expr "$1" : '-g\(.*\)'` + GROUP="`echo \"$1\" | sed 's/^..//'`" CHGROUPIT=true fi ;; @@ -105,7 +105,7 @@ while ${MORETODO} ; do shift ;; X-m*) - MODE=`expr "$1" : '-m\(.*\)'` + MODE="`echo \"$1\" | sed 's/^..//'`" CHMODIT=true ;; X-M) @@ -114,7 +114,7 @@ while ${MORETODO} ; do shift ;; X-M*) - MODE=`expr "$1" : '-m\(.*\)'` + MODE="`echo \"$1\" | sed 's/^..//'`" ${ROOT} && CHMODIT=true ;; X-n) @@ -126,7 +126,7 @@ while ${MORETODO} ; do shift ;; X-o*) - OWNER=`expr "$1" : '-o\(.*\)'` + OWNER="`echo \"$1\" | sed 's/^..//'`" CHOWNIT=true ;; X-O) @@ -136,7 +136,7 @@ while ${MORETODO} ; do ;; X-O*) if ${ROOT} ; then - OWNER=`expr "$1" : '-o\(.*\)'` + OWNER="`echo \"$1\" | sed 's/^..//'`" CHOWNIT=true fi ;; -- 2.40.0