Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jan 2018 01:44:07 -0800
From:      Ultima <ultima1252@gmail.com>
To:        Victor Sudakov <vas@mpeks.tomsk.su>
Cc:        Polytropon <freebsd@edvax.de>, FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Convert .flac and .ape to mp3
Message-ID:  <CANJ8om4W7JTxSYxrLjxkDjDVE8b6CxBcOwPV+PMQ-oQJYuNW9g@mail.gmail.com>
In-Reply-To: <CANJ8om7zUoLM9HCB_5rzC9uWRaPRhCNKcS4-WsXyjZOGGKwDig@mail.gmail.com>
References:  <20180104163421.GA15692@admin.sibptus.transneft.ru> <20180104175156.440fa0c2.freebsd@edvax.de> <20180106063934.GA32231@admin.sibptus.transneft.ru> <CANJ8om7LJqAG+X0dn1JDZn1WYJtxZtX9SAK2yQU74om7-SSQRQ@mail.gmail.com> <20180106085528.GA33117@admin.sibptus.transneft.ru> <CANJ8om7zUoLM9HCB_5rzC9uWRaPRhCNKcS4-WsXyjZOGGKwDig@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Actually, that wont work either. I decided to go look at some of my scripts
where I had to do something similar, the solution was setting IFS.

IFS=$'\n'

On Sat, Jan 6, 2018 at 1:34 AM, Ultima <ultima1252@gmail.com> wrote:

> ah, yeah sorry I didn't understand the problem.
>
> find . -iname "*.ape" -exec echo \"{}\" \;
>
> This should be a solution.
>
> On Sat, Jan 6, 2018 at 12:55 AM, Victor Sudakov <vas@mpeks.tomsk.su>
> wrote:
>
>> Ultima wrote:
>> > > So eventually I will need to write a script to process all the *.ape
>> > > files, probably with bchunk. Which brings the following question. If
>> > > the file and directory names have spaces in them, a simple loop like
>> > > this:
>> > >
>> > > #!/bin/sh
>> > > for i in `find . -iname '*.ape'`
>> > > do
>> > >   do_something $i
>> > > done
>> > >
>> > > breaks on spaces.
>> > >
>> > > What is the sh magic to handle such filenames?
>>
>> > do_something "$i"
>>
>> Nope, these quotes make no difference, they are too late.
>>
>> The problem is in the "for " line, it cannot differentiate spaces _in_
>> filenames and _between_ filenames. Look:
>>
>> $ touch "this is a long file name.ape"
>> $ ~/bin/ape2mp3.sh
>> + find . -iname '*.ape'
>> + echo ./this
>> ./this
>> + echo is
>> is
>> + echo a
>> a
>> + echo long
>> long
>> + echo file
>> file
>> + echo name.ape
>> name.ape
>> $
>>
>> I'm sure the solution exists, it must be a very common case.
>>
>>
>> --
>> Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
>> AS43859
>>
>
>



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CANJ8om4W7JTxSYxrLjxkDjDVE8b6CxBcOwPV+PMQ-oQJYuNW9g>