As an alternative to changing IFS, you can quote or escape the spaces in the text file normally and then use eval to run the output through the shell parser again before mkdir executes.
dirs.txt: dir2 dir 3 dir\ 4 dir5 "dir 6 7" eval mkdir `cat dirs.txt` # or eval mkdir $(cat dirs.txt), depending on your preference for `` or $() Results in: drwxr-xr-x 2 cmyers wheel 68 Jan 23 14:29 dir 4/ drwxr-xr-x 2 cmyers wheel 68 Jan 23 14:29 dir 6 7/ drwxr-xr-x 2 cmyers wheel 68 Jan 23 14:29 dir1/ drwxr-xr-x 2 cmyers wheel 68 Jan 23 14:29 dir2/ drwxr-xr-x 2 cmyers wheel 68 Jan 23 14:29 dir5/ Cheers! -Chad On Friday, January 18, 2019 at 7:10:55 PM UTC-5, Christopher Stone wrote: > > On 01/16/2019, at 19:03, Dave <dave.l...@gmail.com <javascript:>> wrote: > > Thanks, Chris. I've always used that literal newline inside single quotes > in scripts and the command-line, but people think there's something wrong > when they see that continuation prompt. > > ------------------------------ > > Hey Dave, > > The specific point is that the script does everything. The user only has > to provide the text file with the directory list. > > On the other hand I *do* prefer to use a token for a newline character, > because it reads more clearly for me. > > oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS > > In this case Bash 4.4.23 on macOS Sierra 10.12.6 won't convert a > double-quoted string into a newline for the IFS parameter, so I had to > resort to using a C string. > > -- > Take Care, > Chris > > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "supp...@barebones.com" rather than posting to the group. Follow @bbedit on Twitter: <https://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com. To post to this group, send email to bbedit@googlegroups.com. Visit this group at https://groups.google.com/group/bbedit.