Created
May 20, 2014 14:43
-
-
Save conor-egan/ba630767eac8e2aaa13a to your computer and use it in GitHub Desktop.
Bash script to read text file and create new directories
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
################################################################### | |
# Code cycles through a text file and creates a directory for every line in the file | |
# with the contents of the line the title of the directory | |
################################################################### | |
#! /bin/bash | |
while read line # while there are lines in the file | |
do | |
mkdir -p $line # create a new directory in the working directory titled with the #value of the line | |
done <filename.txt # filename.txt should be the name of the text file you are reading |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment