I need to write to a shell script that takes a list of directories from file (the directories would be on different lines) and then for each of those filepaths it would create a hidden dummy file (
.hiddenfile for example) in each of those directories.
See, the problem I'm trying to solve is to commit empty directories into source control and we're using Git, which, ignores empty files. However, I'd like to know reuse this solution (namely, the part where a script takes a list of directories and creates or edits files in each of those directories) for other problems potentially.
The list of directories would be absolute like this:
/Users/johnnydoe/dir1/ /Users/johnnydoe/dir2/subdir2_1/ /Users/johnnydoe/dir3/subdir3_1/subdir3_2/ /Users/johnnydoe/dir4/ ...
The contents of the
.hiddenfile would be arbitrary really. It just needs to have something so that git will commit the files like so:
# don't leave me out of source control
I'm just not sure what Unix command or to use to facilitate this.
I'm using the Mac OS X version of Unix by the way, if that matters.
Any suggestions would be greatly appreciated in advance.