this post was submitted on 07 Jun 2024
4 points (62.5% liked)
#!/bin/bash
77 readers
1 users here now
A community to discuss about Bash.
Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. The shell's name is an acronym for Bourne-Again SHell, a pun on the name of the Bourne shell that it replaces and the notion of being "born again".
Keep discussion limited to Bash and projects around it. Feel free to share resources, self-projects, tutorials or any other cool stuff related to Bash.
Icon Attribution : Free Software Foundation, FAL, via Wikimedia Commons.
founded 9 months ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
ls
returns a list of files, the pipe passes that list to grep. The grep only returns results that match the stringtxt$
. The$
symbol represents an end of line.That's my bad, I asked an incomplete question.
What does the approach of spawning a grep process and having ls send ALL of it's output to grep have over just passing a glob to ls?
Like:
Tbh, I didn't even realise you could do that. I'm just used to using grep and worked backwards. Thanks for pointing it out.