From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6720 invoked by alias); 20 Feb 2012 18:38:02 -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: 16774 Received: (qmail 17520 invoked from network); 20 Feb 2012 18:37:58 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh-users@zsh.org Subject: Re: somehow offtopic: looping filenames In-Reply-To: <20120220181650.GA11514@solfire> (meino cramer's message of "Mon, 20 Feb 2012 19:16:50 +0100") References: <20120220181650.GA11514@solfire> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (gnu/linux) Date: Mon, 20 Feb 2012 19:38:10 +0100 Message-ID: <87boot9wq5.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain X-Df-Sender: [pbs]MDExNTM1 meino.cramer@gmx.de wrote: > I habe a loop like this: > > for fn * > do > flac $fn > done > > Unfortunately, some file have 'illegal' filenames like > > 20120220-_-19db.wav > or > 20120220 sensor10 up.wav > > > which parts flac sees as unknown commmand options or as > two file and the loop fails. So, you're setting `sh_word_split'? Or are you using another shell? This should work in every shell: for i in ./*; do flac "$i" done The ./ makes sure the file name cannot start in a dash, which many applications would otherwise take as an option name. The "$i" makes sure the shell sees the variable contents as one word. Zsh does that with unquoted parameters by default. You'll have to set the `sh_word_split' option to get a more bourne-shell-like behaviour. Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925