Jump to content

For loop at the cli: Revision history

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

4 July 2025

  • curprev 16:1616:16, 4 July 2025 Princesssquishuskush talk contribs 475 bytes +475 Created page with "== General == * Here is an example for loop at the cli * The first prompt is a $, but for each subsequent line the prompt is a > <pre> for file in * do if grep -l blah $file then more $file fi done </pre> * the variable file could just as easily be called i, but file is self documenting * The grep prints the files it finds in the current directory containing blah, and then more prints the contents of the files * The * here is an example of wildcard expansion / globbing"