For the file names below, detox should really do it fine.
The for loop will not work as it will process one word at a time which
mean that it will not process the full file name, but each word on its
own.
One loop that works for this, and there are many different ways of doing
this, is:
ls *|while read name;do
echo "This problematic $name can be processed."
done
Hope this is clear.
Regards, Willem
On Fri, 31 Jul 2015, Tony Baechler wrote:
I apologize in advance to people outside of the US.
Obviously, Christopher, you've never had to deal with books from NLS BARD in
bash before. It's a major problem because of the spaces. I did eventually
find a workaround courtesy of cyberciti.biz. If anyone cares, I'll post my
script, but it's very specific to my local setup. No, I don't wish to rename
them because I want to keep the book number and as much other information as
possible. Out of curiosity, how would you handle names like this? I want to
make a new directory on my SD card under $vrdtb, cd to that directory, unzip
the NLS book and repeat. I generally have at least a few dozen books to
process at a time. Again, I now have a working solution. Until I did some
experimenting and poking around on Google, I had to do this manually. When
NLS started adding a lot more books every week from their analog conversion,
this was no longer practical. The filenames appear below:
DB -- Analog Science Fiction and Fact (Astounding!) (December 2012).zip
DB Asimov's Science Fiction June_ 2013.zip
DB New York Times Book Review October 27_ 2013.zip
DB-Unspecified-The Holy Bible, Containing the Old and New Testaments-
Translated out of the Original Tongues and with the Former Translations
Diligently Compared a-DB68777.zip
To directly answer your question, bash tries to process each word of the
filename separately, even when you put them in quotes, at least in a for
loop. If you manually process one at a time, it works fine. I don't know
why it doesn't work in a for loop even with quoting the filename, but it
doesn't. You have to tell bash to not treat space as a separator.
On 7/30/2015 5:36 AM, Christopher Chaltain wrote:
I guess I'd need to see an example of how these characters trip someone up
in a file name using a BASH script while they are handled differently in
the
DOS batch processor. With few exceptions, I find quoting literals to work
both in a script file and on the command line.
_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list
--
This message is subject to the CSIR's copyright terms and conditions, e-mail
legal notice, and implemented Open Document Format (ODF) standard. The full
disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
Please consider the environment before printing this email.
_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list