From: Emanuel Berg <moasenwood@zoho.eu>
To: zsh-users@zsh.org
Subject: Re: enum-files and change-ext
Date: Tue, 26 Mar 2019 06:29:40 +0100 [thread overview]
Message-ID: <86zhpiw6d7.fsf@zoho.eu> (raw)
In-Reply-To: <264ab4dc-7645-4966-ae3d-615a9663aa5f@www.fastmail.com>
This seems to do better... so far.
#! /bin/zsh
# This file: http://user.it.uu.se/~embe8573/conf/.zsh/files-fs
enumerate-files () {
local -a files
files=($@)
local number=1
local new_name
local ext
for f in $files; do
if [[ -f $f ]]; then
ext=${f:e}
[[ $ext ]] && ext=.$ext
new_name=$number$ext
if [[ -f $new_name ]]; then
files+=($f)
else
mv $f $new_name
fi
number=$(( $number + 1 ))
else
no-file-msg $f # http://user.it.uu.se/~embe8573/conf/.zsh/error
fi
done
}
--
underground experts united
http://user.it.uu.se/~embe8573
prev parent reply other threads:[~2019-03-26 5:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-23 19:49 Emanuel Berg
2019-03-23 20:02 ` Emanuel Berg
2019-03-24 17:52 ` Daniel Shahaf
2019-03-26 5:29 ` Emanuel Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zhpiw6d7.fsf@zoho.eu \
--to=moasenwood@zoho.eu \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).