Last active
July 31, 2017 14:45
-
-
Save Bost/52ec4d8de3b5956abdb455284a79e106 to your computer and use it in GitHub Desktop.
bash: for-loop
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
#!/usr/bin/env bash | |
# Debugging | |
# set -x | |
# Stop on error | |
set -e | |
# Exit if variables are not set (recommended) | |
set –u | |
tstp() { | |
date +"%Y-%m-%d %H:%M:%S,%3N" | |
} | |
# array=( $(find ./ -name '*.txt') ) | |
array=( $(ls) ufo "uff ooo") | |
# array=( one two three ) | |
echo "Array size (length):" ${#array[@]} | |
for i in "${array[@]}"; do | |
echo $(tstp) ${i} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment