Path: aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: Stephane CHAZELAS <stephane_chazelas@yahoo.fr>
Newsgroups: comp.unix.shell
Subject: Re: [g.l.d.user] Re: command to mv files & folders to dir
Date: Sun, 25 Sep 2011 09:15:32 +0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <slrnj7ts9k.6tc.stephane.chazelas@spam.is.invalid>
References: <CABWh29=jQBe+-9OC-=N5Y5PMbUJ8BzfkWUUWvzJRm3O=Vb7LFg@mail.gmail.com>
<86sjnmjmfy.fsf@gray.siamics.net>
<CABWh29mQ9HMCxKG1XF9mGhUyb5mq0M-wJBV4Hr2J9C9ZBtS-Lw@mail.gmail.com>
<867h4yjirp.fsf@gray.siamics.net>
<CABWh29mSFZjwLOR2kuUJegZACYrbZcpQTgCsbdAciWXzdL9gSg@mail.gmail.com>
<86pqiphvjk.fsf@gray.siamics.net>
Injection-Date: Sun, 25 Sep 2011 09:15:32 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="qzG0Li1iwhS8BRIL3GjZtw";
logging-data="2689"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DLDGgnkLTNlOPIa4LylvxHUMUg2vtTOU/kriC5IiwKg=="
User-Agent: slrn/pre1.0.0-18 (Linux)
Cancel-Lock: sha1:WMvpx71iGBMHaeKg5LEfrMqRrX0Mail-Copies-To: nobody
Xref: aioe.org comp.unix.shell:16506
MIME-Version: 1.0
2011-09-25, 15:32(+07), Ivan Shmakov:
[...]
(I hereafter assume that filenames do not contain any special
codes, such as ASCII LF, or Line Feed, or 10.)
[...]
Or backslashes, or trailing blanks.
$ (while read f ; do \
mv -vi -- /mnt/deer/zebra/"$f" /mnt/deer/"$f" ; \
done) < /tmp/deer.list
[...]
Also note that mv with -i might read from its standard input, so
you may prefer:
ret=0
while IFS= read <&3 -r f; do
mv -vi -- "/mnt/deer/zebra/$f" "/mnt/deer/$f" || ret=$?
done 3< /tmp/deer.list
(exit "$ret")
See also xargs(1) to avoid having to use a shell loop.
Stephane
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive:
http://lists.debian.org/86ipogj44o.fsf@gray.siamics.net
Replies