4 ms·
List your files and count them, too: ls -l|tee >(wc -l) Works in bash, but not sh.
by cynwoody 13y ago
List your files and count them, too:
ls -l|tee >(wc -l)
Works in bash, but not sh.
- laumars 13y agoNice example. One minor correction I'd made though, it that you don't need '-l' in your 'ls' parameters as 'ls' automatically outputs one item per line when you're piping it's output, plus the '-l' option adds an additional line. Though if you did still want to see the file permissions but have a correct line count then the following would crop the 1st line from 'ls -l': ls -l | sed 1d | tee >(wc -l) Weirdly though, I thought 'ls' had an option to show a file count, but I can't find it in 'man'.