bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basename sucks


From: Mike Frysinger
Subject: Re: basename sucks
Date: Fri, 2 Feb 2007 11:51:45 -0500
User-agent: KMail/1.9.6

On Friday 02 February 2007, Bob Proulx wrote:
> Alfred M. Szmidt wrote:
> >      echo /home/me/foo | xargs -l basename
> >      foo
> >
> > When doing the filter trick, you'd end up forking three new processes
> > each time.  Which can cause quite a serious slow down in some scripts.
>
> Then Mike's suggestion of using the shell directly is the best choice
> for efficiency.  No process forks and everything is done internally to
> the shell.

all depends on how the code is written ... if  you have to restructure the 
shell code in order to mung the things yourself, this may introduce loops 
that did not exist before ... bash isnt exactly speedy when it comes to loops

i do use those shell replacements myself in many places where i'm doing one 
off jobbies

> Or perhaps one should use a fully shell replacement such as this bash
> snippet that is also a filter?

you cant pipe into shell functions :(
-mike

Attachment: pgpnhSKV7ORFV.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]