Re: [PATCH] Fixed non portable use of expr, and incorrect use of test -eq for string comparison.

From
martin f krafft <hidden>
Date
2016-06-15 22:43:30
Reply to
David Jack Olrik, 2016-06-15
also sprach David Jack Olrik [off-list ref] [2007.08.22.1402 +0200]:
-	if test "`expr index $httpd_only /`" -eq '1' || \
+	if test "`echo $httpd_only | cut -c 1`" = '/' || \
how about

  if [ "$httpd_only" != "${httpd_only#/}" ]; then

that should do the same and does so without external processes.
 				which $httpd_only >/dev/null
This is also not really portable. I suggest the use of

  command -v $http_only

first, that's shell-internal as well, and second, it's
/more/ portable than which, but also not entirely.

http://www.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html#s-bpp-debian-maint-scripts

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
"of course the music is a great difficulty.
 you see, if one plays good music, people don't listen,
 and if one plays bad music people don't talk."
                                                        -- oscar wilde
 
spamtraps: madduck.bogus@madduck.net

Attachments

Thread (7 messages) 7 messages, 3 authors, last reply 2016-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help