News for hackers. Stuff that matters.
Re:GNU Coreutils Gotchas by ksherlock on Monday November 30, 2015 @09:05AM (#10649382)
if you need to pipe it in, you should

    basename `echo $PWD`
Re:GNU Coreutils Gotchas by protomyth on Monday November 30, 2015 @09:17AM (#10649458)
uhm, what?

Can you give an example where I have a file (a.txt) of 100 file names and need the basename of each? I'm pretty sure dvh just used echo to show a simple example, not an actual use.

Re:GNU Coreutils Gotchas by erdbeerkaese on Monday November 30, 2015 @09:55AM (#10649661)
Another way:

  while read line ; do basename "$line" ; done < a.txt
Re:GNU Coreutils Gotchas by wyldfire on Monday November 30, 2015 @10:08AM (#10649733)
Yeah, I think I prefer yours. Probably more robust wrt filenames-with-whitespace too.
Re:GNU Coreutils Gotchas by protomyth on Monday November 30, 2015 @11:23AM (#10650144)
Both solutions although nice and helpful pretty much illustrate why I ended up writing a filter capable version.
Re:GNU Coreutils Gotchas by wyldfire on Monday November 30, 2015 @09:52AM (#10649643)
How about this?

    for f in $(cat a.txt); do basename "$f"; done
Re:GNU Coreutils Gotchas by yrro on Monday November 30, 2015 @11:27AM (#10650174)
1. Broken by filenames that contain whitespace.

2. The shell will expand * and ? (maybe others) in the filenames

Re:GNU Coreutils Gotchas by pixelbeat on Monday November 30, 2015 @11:25AM (#10650159)

    xargs basename -a < a.txt
Re:GNU Coreutils Gotchas by protomyth on Wednesday December 02, 2015 @11:33AM (#10663907)
I take it -a is one of those GNU extensions?