Created
September 26, 2020 08:58
-
-
Save e-roux/a3ec9617ef2e6e22d86382c08d46dcb3 to your computer and use it in GitHub Desktop.
Setup for zsh glob demo
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
# This gist is from | |
# https://reasoniamhere.com/2014/01/11/outrageously-useful-tips-to-master-your-z-shell/ | |
cd ${TMP:-/tmp} | |
# create the folder structure | |
mkdir -p zsh_demo/{data,calculations}/africa/{kenya,malawi}/ \ | |
zsh_demo/{data,calculations}/europe/{malta,poland}/ \ | |
zsh_demo/{data,calculations}/asia/{nepal,laos}/ | |
# create dummy files inside the data folder | |
for country_folder in zsh_demo/data/*/*; do | |
dd if=/dev/zero of="${country_folder}/population.txt" bs=1024 count=1 | |
dd if=/dev/zero of="${country_folder}/income.txt" bs=2048 count=1 | |
dd if=/dev/zero of="${country_folder}/literacy.txt" bs=4096 count=1 | |
# we say these are dummy files because they don't have any content, | |
# but we are making them occupy disk space | |
done | |
# create dummy files inside the calculations folder | |
for country_folder in zsh_demo/calculations/*/*; do | |
touch "${country_folder}/population_by_province.txt" # this file is empty | |
dd if=/dev/zero of="${country_folder}/median_income.txt" bs=2048 count=1 | |
dd if=/dev/zero of="${country_folder}/literacy_index.txt" bs=4096 count=1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment