Skip to content

Instantly share code, notes, and snippets.

@var-bin
Last active March 9, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save var-bin/aaf2f878cc0eec04d5618207ba1dd6ad to your computer and use it in GitHub Desktop.
Save var-bin/aaf2f878cc0eec04d5618207ba1dd6ad to your computer and use it in GitHub Desktop.
for in in bash, example. Repository https://github.com/var-bin/terminalForCoder__WSD
#!/bin/bash
for i in 1 2 3 4 5
do
file_name="file${i}.txt"
if [[ -e "$file_name" ]]
then
continue
fi
echo "Creating file ${file_name}"
touch "$file_name"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment