Tuesday, April 18, 2017

Working with Files in Bash

I always forget how to loop through files in a Bash shell. Below are two snippets for looping through files using Bash.

Using a FOR loop in a script.

for file in $(command for files); do
    echo $file
done

Single line command.

find . -name "file glob" -exec command '{}' \;

No comments:

Post a Comment