linux - What does an asterisk at the end of a mv command do -
so going along , moving bunch of files
mv /source /dest & mv /source/* /dest/dest/ & ... ...
then careless and
mv /source/filena* /dest/dest/ *
omg! ^c^c^c^c
[no response terminal command] going on here?
what happens when put *
(asterisk) @ end of command instead of &
(ampersand)?
the shell expands wildcard *
. mv
command never sees wildcard, result of expansion.
the wildcard *
expands list of files in current directory in lexicographic order. if last file directory, preceding files (/source.filenafoo
, /source/filenabar
, /dest/dest
, hello
) moved subdirectory. if last file not directory, mv
complains “target a.png
not directory” (or words effect).
see what mv ./*
without specifying destination do? more detailed examples.
Comments
Post a Comment