GNU bug report logs -
#14023
dirname/basename unexpected results when run by xargs -I
Previous Next
Full log
Message #24 received at 14023 <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 12 years and 64 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.