Created
June 18, 2013 16:43
-
-
Save fstamour/5807070 to your computer and use it in GitHub Desktop.
Shell snippet to get a file list into an array.
This file contains hidden or 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
| #From http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html | |
| # save and change IFS | |
| OLDIFS=$IFS | |
| IFS=$'\n' | |
| # read all file name into an array | |
| fileArray=($(find $DIR -type f)) | |
| # restore it | |
| IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment