if echo “$line” | grep -q “somestring” ; then That's a lot of typing. I knew there was a way to do it without programming it. fi shell by Thankful Tapir on Feb 22 2020 Donate . If you continue to use this site we will assume that you are happy with it. bash while loop syntax The syntax is as follows: The while construct allows for repetitive execution of a list of commands, as long as the command controlling the while loop executes successfully (exit status of zero). Une variable modifiée dans une boucle while n'est pas mémorisée (4) C'est une question intéressante et touche un concept très basique dans Bourne shell et subhell. Comment faire écho aux étoiles(*) lors de la lecture du mot de passe avec `read`? Loops are handy when you want to run a series of commands a number of times until a particular condition is met. Step 1: Using the pup utility (or command-line HTML parser of your choice): Step 2 (assuming the words variable is being passed along): Check out Software Carpentry's excellent guide to for-loops in Bash, CompCiv is a Stanford Journalism course taught by Dan Nguyen, # send the stream through a reverse filter, # filter out words with less than 4 characters, # send an email with the page's title and word count, Computational Methods in the Civic Sphere, Software Carpentry's excellent guide to for-loops in Bash, Software-Carpentry's guide to the Unix Shell, Fetch a list of ten 10+-letter words from nytimes.com headlines. / bin / bash while read line do echo-e "$ line \ n" done