Firstly, the answer to your issue with mv. You need to read the man page a little closer (I had to too
). The '-i' option for mv is
only interactive if the file you are moving
to already exists:
Code:
$ ls
f1 f2
$ for i in *; do mv -i $i $i.old; done
$ ls
f1.old f2.old
$ touch f1 f2
$ ls
f1 f1.old f2 f2.old
$ for i in *; do mv -i $i $i.old; done
mv: overwrite `f1.old'? n
mv: overwrite `f2.old'? n
$ ls
f1 f1.old.old f2 f2.old.old
So the things to notice here are:
1. When the destination name does not exist there is no prompting
2. Due to step 1, the final results are probably not what was expected
Quote:
May I ask you why exactly should you not use ls for input.
|
Always happy to answer questions
See the following link for answers:
http://mywiki.wooledge.org/ParsingLs