Skip to content

Instantly share code, notes, and snippets.

@PabloVallejo
Created January 15, 2013 01:38
Show Gist options
  • Save PabloVallejo/4535279 to your computer and use it in GitHub Desktop.
Save PabloVallejo/4535279 to your computer and use it in GitHub Desktop.
Shell loops
#!/bin/bash
# Basic For Loop
for file in ${_BadMaps[*]}
do
echo "$file"
end
#!/bin/bash
# For loop with validation
# Make sure the folder exists!
if [ -d _BadMaps ] ; then
echo "Good!"
else
echo "JESUS NNOO!!!!!!"
exit 1
fi
# Make sure there is at least one file in there
if [ -f _BadMaps/DM-MetalHell.ut2 ] ; then
echo "Good!"
else
echo "GOD NNOO!!!!!!"
exit 1
fi
# Echo out all files in directory!
for file in _BadMaps/*.ut2 ; do
echo "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment