Skip to content

Instantly share code, notes, and snippets.

@maneta
Last active January 9, 2019 13:02
Show Gist options
  • Save maneta/3bed2af0890f5ca13f5017c725c9dd5a to your computer and use it in GitHub Desktop.
Save maneta/3bed2af0890f5ca13f5017c725c9dd5a to your computer and use it in GitHub Desktop.
#!/bin/bash
#Creating the five directory
mkdir ./five
for counter in {1..5}
do
#Creates the dir1..dir5 directories
mkdir ./five/dir$counter
for files in {1..4}
do
#Creates the files inside de dir1..dir5 dirs
touch ./five/dir$counter/file$files.txt
#BLACK MAGIC ALERT: using the comand seq to iterate over sequence of number
#More info on stack overflow: https://stackoverflow.com/questions/169511/how-do-i-iterate-over-a-range-of-numbers-defined-by-variables-in-bash
for echo in $(seq 1 $files)
do
echo "$files" >> ./five/dir$counter/file$files.txt
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment