bug-coreutils
[Top][All Lists]
Advanced

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

bug#14023: dirname/basename unexpected results when run by xargs -I


From: Bob Proulx
Subject: bug#14023: dirname/basename unexpected results when run by xargs -I
Date: Sat, 23 Mar 2013 09:11:06 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Juho-Pekka Kuitunen wrote:
> Eric Blake wrote:
> > By the way, your question is mostly related to shell, and a bit with
> > xargs, and practically nothing to do with dirname.  Your confusion on
> > WHEN $() is expanded would apply no matter what executable you plug in
> > instead of dirname.  But since neither sh nor xargs belongs to
> > coreutils, you might get better answers by asking on a general forum on
> > shell programming subtleties.
> >
> >> Very much possibly not a bug but I'm not 100% convinced yet. I've been
> >> chuckling at this all evening, love a good brain teaser even if it
> >> turns out to be something I overlooked instead of a bug. :-)
> >
> > Hopefully shell tracing has managed to convince you.
> 
> Yup, that did the trick. Looks like I didn't understand the way xargs
> works nearly well enough. Thanks for the lesson, my bad!

The place to look for the explanation is in the shell documentation.
In the bash manual this is in the "EXPANSION" section.  In that
section it walks through a number of expansions.  One of those is
"Command Substitution".  This is done by the shell uniformly for all
commands before the command is invoked so it and the other expansions
are a good thing to understand.  The shell effectively modifies the
command line you typed into a dynamically created set of arguments for
the command being invoked.

I have closed the bug ticket to finish our accounting.  But feel free
to continue adding information to this bug log.  It continues to be
active and available.

Bob





reply via email to

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