Re: [PATCH] Fixed non portable use of expr, and incorrect use of test -eq for string comparison.
- From
- martin f krafft <madduck@madduck.net>
- Date
- Aug 22, 2007, 21:00 UTC
- Message-ID
- <20070822210001.GA7585@piper.oerlikon.madduck.net>
- In-Reply-To
- <11877841633473-git-send-email-david@olrik.dk>
also sprach David Jack Olrik <david@olrik.dk> [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#/}" ]; thenthat 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