Re: NEBIE Question on mv
- From: Andrew Smallshaw <andrews@xxxxxxxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 20:06:04 +0100 (CET)
On 2007-12-31, Samantha <samantha@xxxxxxxxxxx> wrote:
I just went ahead and typed the following command:
% mv science.bck ./backups
and that worked fine. It means move the file from the current directory
to the current directory (the period) plus the sub directory /backups.
I understand that.
Well looking at the tutorial, this is the answer they gave to execute
the move.
% mv science.bak backups/.
The period is pretty much meaningless - it is an entry in every
directory that references that directory itself. In both
../backups and backups/. it is redundant. Unless they begin with
a / to denote an absolute pathname pathnames are generally relative
to the current directory and so all path/filenames begin with an
implicit "./" .
An explicit "./backups" says "look at the current directory. Then
look at "." (the current directory again). Then look at backups
in that directory." Similarly "backups/." says "Look at the current
directory, then look at backups in that directory. Then look at
that directory again."
In other words it is nothing more than a waste of time in these
circumstances. It isn't even the whole story either, as "././backups"
and "backups/././" and even "./././././backups/./././././././" all
refer to the same place with various amounts of pointless looping
around.
Where does . come in useful? Primarily where you need to specify
a directory and in that particular instance the current directory
is the one you want. In something like "cp lots os different files ."
the . is required since in that context the last parameter must be
a directory, and . is a simple shorthand to specify the current
working directory. "." also has uses in protecting certain potentially
troublesome filenames from being interpreted in a special manner,
but that is a more advanced topic best not tackled right now.
The companion to . is .. which always refers to the parent of the
referenced directory, except in the root directory where it references
itself the same as ".". In your example above a straight .. would
refer to your home directory (which itself can usually be referred
to as "~", but the mechanism for that differs). A reference to
"backups/.." would refer to the parent of backups, i.e. the current
directory, the same as "." only less direct.
--
Andrew Smallshaw
andrews@xxxxxxxxxxxxxxxx
.
- References:
- NEBIE Question on mv
- From: Samantha
- NEBIE Question on mv
- Prev by Date: Re: NEBIE Question on mv
- Next by Date: Re: NEBIE Question on mv
- Previous by thread: Re: NEBIE Question on mv
- Index(es):
Relevant Pages
|