[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] basename/dirname can't handle stdin?
From: |
Bob Proulx |
Subject: |
Re: [coreutils] basename/dirname can't handle stdin? |
Date: |
Wed, 12 Jan 2011 13:09:00 -0700 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Jeff Blaine wrote:
> The following fails:
> echo /some/place/foo.txt | basename
As Eric noted, basename requires an argument.
> This also fails:
> find /somewhere -print | xargs basename
Why did that fail? Are you also getting an error message from find?
You usually want to include the xargs -r option if you think it might
not have any input at all.
find /somewhere -print | xargs -r basename
> This *does* work though, somehow, when the above does not:
> echo /some/place/foo.txt | xargs basename
That will invoke basename with one argument. Which is fine.
You can verify what xargs will do by calling echo first.
find /somewhere -print | xargs echo basename
echo /some/place/foo.txt | xargs echo basename
Bob
- Re: [coreutils] basename/dirname can't handle stdin?, (continued)
- Re: [coreutils] basename/dirname can't handle stdin?, Jim Meyering, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Eric Blake, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Jeff Blaine, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Jeff Blaine, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Eric Blake, 2011/01/13
- [coreutils] Re: basename/dirname can't handle stdin?, Andreas Schwab, 2011/01/14
- Re: [coreutils] basename/dirname can't handle stdin?, Eric Blake, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Pádraig Brady, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Eric Blake, 2011/01/13
- Re: [coreutils] basename/dirname can't handle stdin?, Pádraig Brady, 2011/01/13
Re: [coreutils] basename/dirname can't handle stdin?,
Bob Proulx <=