[Nottingham] "unescaping" the wildcard character for xargs

Camilo Mesias camilo at mesias.co.uk
Tue Jun 19 21:32:07 UTC 2012


On Tue, Jun 19, 2012 at 2:57 PM, Martin <martin at ml1.co.uk> wrote:
> Please expand further?

This is going to sound weird, but I imagined there was a command that
did that... I tried it out and it seemed to work - the area I tested
it in had enough files that the output scrolled the "command not
found" off the screen.

In fact if would work if there was such a command, but since there
isn't... I tried writing one as an alias:

alias glob="perl -pe '\$_=join \" \", glob'"

Then things like

echo 'a/*' 'b/*' | glob |xargs cat

do what you'd expect.

I would probably be tempted to solve this a different way that didn't
involve the '*' in the input - maybe plain paths and find would work.

-Cam



More information about the Nottingham mailing list