From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16481 invoked by alias); 20 Feb 2012 19:05:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16775 Received: (qmail 28274 invoked from network); 20 Feb 2012 19:05:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120220110530.ZM450@torch.brasslantern.com> Date: Mon, 20 Feb 2012 11:05:30 -0800 In-reply-to: <20120220181650.GA11514@solfire> Comments: In reply to meino.cramer@gmx.de "somehow offtopic: looping filenames" (Feb 20, 7:16pm) References: <20120220181650.GA11514@solfire> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: somehow offtopic: looping filenames MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 20, 7:16pm, meino.cramer@gmx.de wrote: } } I habe a loop like this: } } for fn * } do } flac $fn } done } } Unfortunately, some file have 'illegal' filenames } which parts flac sees as unknown commmand options or as } two file and the loop fails. Try this: for fn * do flac $fn:a done The :a modifier expands $fn into a full path including removing any mentions of "./" and "../". Think of it as a clean "$PWD/$fn". If you don't have a recent-enough zsh for :a to be supported or it is for some reason important to avoid the full path, try flac ${${fn:h}-.}/${fn:t} If that's still confusing it because e.g. you have SH_WORD_SPLIT turned on, wrap the expression in double quotes.