Created
August 8, 2018 21:08
-
-
Save krystofl/9f6d2b88cf2a7e98270a60956028ad1e to your computer and use it in GitHub Desktop.
Simple shell script to show how to get a list of files and perform some action on all of them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple script to show how to get a list of files in a directory, | |
# and perform some action on all of them | |
# get the list of all the files we want to use | |
files=$(ls -1 *.txt) | |
# print list of all of them | |
# echo ${files[@]} | |
# infinite loop | |
# Ctrl + C to exit | |
while true; do | |
# do something to each one | |
for file in $files; do | |
echo $file | |
done | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment