我有一堆文件 具有不同的扩展名
.png .fa .sh
在目录中哪个叫“文件”
我要移动
.png to images file
.fa to fasta file
.sh to upper directory Golden_Asian.git/
.png和.fa运作良好 但是对于.sh,当我这样做时
mv files/*.sh Golden_Asian.git
它只是制作了类型POSIX shell脚本,ASCII文本可执行文件,该文件名为
Golden_Asian.git
原始文件的名称为
script.sh
所以我应该得到像
Golden_Asian.git/script.sh
我做错了还是正确的结果?
“文件”目录中的原始文件已消失,所以我很确定 文件已传输到正确的目录,但不知道为什么更改了名称。
It's the right result if there was only one
.sh
file and there was no directory calledGolden_Asian.git
in the current directory. You executedmv script.sh Golden_Asian.git
, so it moved the file from the original name to the name you specified. If there was already a fileGolden_Asian.git
in the current directory, it would be clobbered (replaced) by the new file.如果指定:
then it would have required the directory to exist and the result would have been a file
Golden_Asian.git/script.sh
. If you'd had more than one.sh
file, then you'd have needed the directoryGolden_Asian.git
to exist. You said "upper directory"; did you intend to write:If there was a directory in the parent directory called
Golden_Asian.git
, then the script would have been moved there. If there was no directory, the file would have been moved up a level and renamed. Again, a trailing/
would have prevented confusion.Note that moving a file into a GIT directory (especially a bare repository) is probably not a good idea.