[PLUG] a question on "mv" command

Pete Lancashire pete at petelancashire.com
Tue Oct 3 16:39:29 UTC 2017


Use to be a good 'test' for a Comp Sci class.

Before the class

touch a b c

mkdir d

In the class

mv *



On Tue, Oct 3, 2017 at 9:25 AM, VY <vyau5678 at gmail.com> wrote:

> Thanks for all the replies. I completely forgotten about "*" being
> interpreted by the shell.
> That makes sense now...
>
> thanks again!
>
>
> On Tue, Oct 3, 2017 at 9:16 AM, John Meissen <john at meissen.org> wrote:
>
> > The 'mv' command takes the last argument as the destination. The shell
> will
> > expand the wildcard into a list before calling 'mv' (or performing it,
> as I
> > think it's actually built-in), so in your example
> >   mv *
> > is equivalent to
> >   mv a b c
> >
> > > Dear All
> > >
> > > Yesterday, I was told of this usage of "mv" and I could not figure out
> > why
> > > it would work.
> > > So I am sending out my question
> > >
> > > Say I am in a directory with 3 sub-directories "a", "b" and "c".
> > > I then type
> > >
> > >     bash>   mv *
> > >
> > > Directory "a" and "b" would move under "c".
> > >
> > > I re-read the man page for "mv" and nothing says it can do this.  And
> it
> > did
> > > say there needs to be a "source and "destination".  From this command
> > above,
> > > there isn't that 2-parameter requirement.
> > >
> > > Can anyone explain why this would work?  Or is this an undocumented
> > > side-effect
> > > for "mv"?
> > >
> > > thanks
> > >
> > > -v
> > > _______________________________________________
> > > PLUG mailing list
> > > PLUG at lists.pdxlinux.org
> > > http://lists.pdxlinux.org/mailman/listinfo/plug
> >
> >
> > _______________________________________________
> > PLUG mailing list
> > PLUG at lists.pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
> >
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list