Re: shorthand attempt at 'basename file .ext'

2008-03-29 Thread Chris F.A. Johnson
On 2008-03-28, Eric Blake wrote: Chris F.A. Johnson cfajohnson at gmail.com writes: You can find a shell function to replace the external basename command at: http://cfaj.freeshell.org/shell/scripts/basename-sh. Except that your example is not POSIX-compliant. POSIX requires

Re: shorthand attempt at 'basename file .ext'

2008-03-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Chris F.A. Johnson on 3/29/2008 10:53 AM: | Also, on platforms where // is special (such as cygwin), 'basename //' | and 'basename // /' should print '//', not '/', to match the behavior of the | basename program on those platforms. | |

Re: shorthand attempt at 'basename file .ext'

2008-03-28 Thread Eric Blake
Chris F.A. Johnson cfajohnson at gmail.com writes: You can find a shell function to replace the external basename command at: http://cfaj.freeshell.org/shell/scripts/basename-sh. Except that your example is not POSIX-compliant. POSIX requires 'basename -- -a' to print '-a', not '--'.

Re: shorthand attempt at 'basename file .ext'

2008-03-27 Thread Chris F.A. Johnson
On 2008-03-25, Linda Walsh wrote: hey folks, have what is maybe, mostly a mental exercise, but... just thought that I might find some programs benefiting by not calling the external /[usr]/bin/{basename,filename} progs... You can find a shell function to replace the external basename

shorthand attempt at 'basename file .ext'

2008-03-25 Thread Linda Walsh
hey folks, have what is maybe, mostly a mental exercise, but... forgive me if this is obvious, but seems I tried this before and didn't see 'obvious' way to make this work. could be viewed as a 'bug' (in terms of consistency' maybe?), but, I'd understand that the design may have been limited to

Re: shorthand attempt at 'basename file .ext'

2008-03-25 Thread Paul Jarc
Linda Walsh [EMAIL PROTECTED] wrote: echo ${{f##*/}%$ext} (but: -bash: ${{f##*/}%$ext}: bad substitution) Do I need to use an intermediate variable Yes. Unfortunately, the expansion operators work directly on variables - not on arbitrary strings which may contain other expansions. paul