[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FYI] Remove $SED from basename and dirname definitions
From: |
Ralf Wildenhues |
Subject: |
Re: [FYI] Remove $SED from basename and dirname definitions |
Date: |
Fri, 13 Feb 2004 07:57:33 +0100 |
User-agent: |
Mutt/1.4.1i |
* Scott James Remnant wrote on Thu, Feb 12, 2004 at 08:20:38PM CET:
>
> diff -ruNp libtool-CVS~/ChangeLog libtool-CVS/ChangeLog
> --- libtool-CVS~/ChangeLog 2004-02-12 19:07:29.000000000 +0000
> +++ libtool-CVS/ChangeLog 2004-02-12 19:18:21.000000000 +0000
> @@ -0,0 +1,7 @@
> +2004-02-12 Scott James Remnant <address@hidden>
> +
> + * ltmain.in, libtoolize.in, commit, config/mailnotify: Remove
> + $SED from definitions of $dirname and $basename and prefix each
> + use with it instead. Some shells (zsh) treat the expansion as
> + a single command instead of a command with arguments.
> +
Just curious: should't zsh be configurable to change this behaviour?
This does not sound sh-compatible to me. Are there any other shells
exhibiting this behaviour?
> diff -ruNp libtool-CVS~/commit libtool-CVS/commit
> --- libtool-CVS~/commit 2004-02-12 16:47:43.000000000 +0000
> +++ libtool-CVS/commit 2004-02-12 19:09:18.000000000 +0000
> @@ -73,8 +73,8 @@
> : ${RM="rm -f"}
> : ${SED="sed"}
>
> -dirname="$SED s,/[^/]*$,,"
> -basename="$SED s,^.*/,,g"
> +dirname="s,/[^/]*$,,"
> +basename="s,^.*/,,g"
>
> # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
> # is ksh but when the shell is invoked as "sh" and the current value of
> @@ -84,7 +84,7 @@ basename="$SED s,^.*/,,g"
> progpath="$0"
>
> # The name of this program:
> -progname=`echo "$progpath" | $basename`
> +progname=`echo "$progpath" | $SED $basename`
With above change, IMVHO you need "$basename" here, else pathname
expansion will apply. Same with other occurrences of dirname and
basename.
Regards,
Ralf