bug-coreutils
[Top][All Lists]
Advanced

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

Re: [COREUTILS] dirname line commands


From: Eric Blake
Subject: Re: [COREUTILS] dirname line commands
Date: Fri, 21 Jul 2006 01:33:50 +0000

> dirname: too many arguments
> Try `dirname --help' for more information.
> 
> 
> instead i had to get jiggy and issue
> 
> for i in `locate asterisk` ; do dirname $i ; done | sort | uniq
> 
> why doesn't dirname eat the stdin from xargs ( i tried a bunch or xargs 
> switches -d and -e to no avail.)

Because dirname is documented as taking exactly one argument,
thanks to POSIX.  Try xargs -L 1 to force one filename per dirname
invocation (although that does turn into as many processes as your
for loop).  Or consider using a sed script instead, to reduce the
process load of computing multiple dirnames over a list.

-- 
Eric Blake




reply via email to

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