I'm trying to write a bash shell script that will read the data from a given (as an argument) file, and for each row in the file, make a sub-directory under the given (as an argument) directory.
The script is named
studentDir and the input file is named
Here is two lines from it:
Sara Smith Freshman Marketing James Lucas Junior Engineering
On the command line the user would write the script name, the txt file name, and the directory where the new directories should be stored. I think it would be like this:
$ studentDir studentInfo.txt .
Which will create the sub-directories in the current directory.
The directories should be named LLLLFF.
(The other info from the input file is not needed)
I think to get the names I would use:
DIRNAME=$(cut -d' ' -f2 | cut -c1-4 ; cut -d' ' -f1 | cut -c1-2) mkdir "$DIRNAME"
But I'm not sure what command would create a directory for each row, and how I could do it recursively for each one.