<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Tue, 2010-12-14 at 15:08 -0800, Dan Nicholson wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Tue, Dec 14, 2010 at 7:38 AM, Gaetan Nadon <<A HREF="mailto:memsize@videotron.ca">memsize@videotron.ca</A>> wrote:
> If invoked from $PREFIX you currently you get:
> Usage: util/modular/build.sh [options] prefix
>
> Where you should always get:
> Usage: build.sh [options] prefix
>
> The path name is not part of the usage. The GNU compiler and
> associated tools do not use the path.
>
> Autoconf recommends using "expr" rather than "basename" for portability.
>
> Signed-off-by: Gaetan Nadon <<A HREF="mailto:memsize@videotron.ca">memsize@videotron.ca</A>>
> ---
> build.sh | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/build.sh b/build.sh
> index d6c946e..027c1c0 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -934,7 +934,8 @@ process_module_file() {
> }
>
> usage() {
> - echo "Usage: $0 [options] prefix"
> + basename="`expr "//$0" : '.*/\([^/]*\)'`"
> + echo "Usage: $basename [options] prefix"
> echo " where options are:"
> echo " -a : do NOT run auto config tools (autogen.sh, configure)"
> echo " -b : use .build.$HAVE_ARCH build directory"
> @@ -953,7 +954,7 @@ usage() {
> echo " --cmd cmd : execute arbitrary git, gmake, or make command 'cmd'"
> echo " --modfile file : only process the module/components specified in 'file'"
> echo ""
> - echo "Usage: $0 -L"
> + echo "Usage: $basename -L"
> echo " -L : just list modules to build"
> echo ""
> envoptions
Since build.sh is a POSIX shell script, might I suggest parameter
expansion with ${0##*/}?
</PRE>
</BLOCKQUOTE>
Thanks for the suggestion. <BR>
<BR>
My Bash book says that "pattern-matching variable operators"<BR>
do not work on the Bourne shell and we have build.sh users running with this shell.<BR>
<BR>
Trevor had to remove getopt() and local variables. Would we face similar issues<BR>
with this operator?<BR>
<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
--
Dan
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>