Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: somehow offtopic: looping filenames
- X-seq: zsh-users 16775
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: somehow offtopic: looping filenames
- Date: Mon, 20 Feb 2012 11:05:30 -0800
- In-reply-to: <20120220181650.GA11514@solfire>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20120220181650.GA11514@solfire>
On Feb 20, 7:16pm, meino.cramer@xxxxxx 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author