From owner-freebsd-questions@freebsd.org Sat Jan 6 09:44:09 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 683B0EA5740 for ; Sat, 6 Jan 2018 09:44:09 +0000 (UTC) (envelope-from ultima1252@gmail.com) Received: from mail-yb0-x234.google.com (mail-yb0-x234.google.com [IPv6:2607:f8b0:4002:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2108E7EFEA for ; Sat, 6 Jan 2018 09:44:09 +0000 (UTC) (envelope-from ultima1252@gmail.com) Received: by mail-yb0-x234.google.com with SMTP id j7so2772803ybl.3 for ; Sat, 06 Jan 2018 01:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yU95AwkglECLcmOJWp4Wv3VO2JhUc0F9Rkwas+j4cBs=; b=qTnNfvJmlholqeMzcikJIkEwFOsrjOZ0LvPXya+Rec32wDpVdOJaPCx5dJQtbID3rM ZffjgxNGYppC/0fb4Jxjv/bIrnh/ywjFUC+II6Isx6w4RIt8qUhzQbYwHyKeIfOLyhVO G8dKjMugzS3UczfyNvVp/cAf0xt+qHJRZa7bIyLAl+upftEzPZC5lMlZo/B9uVG3IGti gum/UDi+Xg1Nd3wckKKkZx9MmakbZr2VsMyoeB43V7tbipw7zZFVuPfrD+7r8spFBpdX 1Y+tsCP5S1WXX86FS3sf925dt4hCSMAT1EpaimgYM1gXns9FJFk/xQD8Bnd1rZaGT99R h0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yU95AwkglECLcmOJWp4Wv3VO2JhUc0F9Rkwas+j4cBs=; b=rs98Y0p8f2SeVTSnzLDPAc49YTzT1pHGLkPJPtEYw/EhH5otz8BLg5fdBhbMi8gRN4 dk3UmhEn1aSYZrFtNH4/iHI9s1bkFQ7bpS2iBGeQfNtzMtOo175GUebK2rL6zdrS+3UF rq6n+oDefXAyF2gNv3BVYQ/+y72hOjIw7lE5gG5tdZlqzAauMDCrnePytXt1zHgg+aD0 ZXqMrwNwN39zrZeL2vSiNcHQkEM2qqO7KMPDMELvpTBSGyezQgNOQFJGqaLRFVHPMpHV txL9UEfcErqCv/8toPdUOmKkV9xIAXsMZOlLPWH22M4t+mLejQHwqvAM2xz083iUtQ+o YEZw== X-Gm-Message-State: AKGB3mI/rZwyRU45Z8KNF/IAILkud/TSrd5RK9g/d7FT6wd1gRDOwQuZ jZdEoNtDSUZeXopfgfhnDSfn1OUzaOkY/ip6rvg= X-Google-Smtp-Source: ACJfBou9hrn4rNCf9NfSiKdHFrcZCmcHe3+wkAaaVLikzqSZtLGNEOTcNOFjXjRToIIvb2/RCk/UfJcOJx6GuS1G7E0= X-Received: by 10.37.129.204 with SMTP id n12mr5356487ybm.217.1515231848155; Sat, 06 Jan 2018 01:44:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.174.3 with HTTP; Sat, 6 Jan 2018 01:44:07 -0800 (PST) In-Reply-To: References: <20180104163421.GA15692@admin.sibptus.transneft.ru> <20180104175156.440fa0c2.freebsd@edvax.de> <20180106063934.GA32231@admin.sibptus.transneft.ru> <20180106085528.GA33117@admin.sibptus.transneft.ru> From: Ultima Date: Sat, 6 Jan 2018 01:44:07 -0800 Message-ID: Subject: Re: Convert .flac and .ape to mp3 To: Victor Sudakov Cc: Polytropon , FreeBSD Mailing List Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jan 2018 09:44:09 -0000 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 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 > 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 >> > >