Answers for "loop a command result by line bash"

1

bash for loop find

#!/bin/bash

find . -name *.mp3 |
while read filename
do
    echo "$filename"    # ... or any other command using $filename
done
Posted by: Guest on April-01-2021
1

loop bash

Use for in bash for iterating words in a string or values in an array as:
for value in {1, 2, 3}; do echo $value; done
for value in $(cat arguments_files.txt); do [some_command]; done
And use while for iterating lines from a pipe output as:
cat arguments_file.txt | while read line; do [some_command]; done
Posted by: Guest on October-26-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language