3 ms·
if you need to pipe it in, you should basename `echo $PWD`
by ksherlock 11y ago
if you need to pipe it in, you should
basename `echo $PWD`
- protomyth 11y agouhm, 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.
- wyldfire 11y agoHow about this? for f in $(cat a.txt); do basename "$f"; done
- yrro 11y ago1. Broken by filenames that contain whitespace. 2. The shell will expand * and ? (maybe others) in the filenames
- erdbeerkaese 11y agoAnother way: while read line ; do basename "$line" ; done < a.txt
- pixelbeat 11y agoxargs basename -a < a.txt
- protomyth 11y agoI take it -a is one of those GNU extensions?