LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-30-2008, 12:31 PM   #1
nanosec
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Rep: Reputation: 0
What does it mean this command cp /etc/. /tmp ?


What does it mean this command cp /etc/. /tmp ?

I don't understand about symbol "." after /etc/.

Please, help to clarify.

Thanks
 
Old 07-30-2008, 01:04 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What is the context of this? (or--what are you trying to do?) On the surface of it, it does not make much sense.

Possible (special) meanings of "." in Bash:
current directory
prefix for a hidden file
any character (in a regular expression)
 
Old 07-30-2008, 02:29 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
[ edit: Never mind - misread, but I'll leave my original interpretation anyway ]

It means somebody concatenated two path components together, but didn't bother with path canonicalization. The internal /./ is superfluous and can be removed.

Eg:

non-canonical path: /etc/. /tmp
canonical path: /etc/tmp

This routinely occurs when you have two vars combined into a path:

Code:
$ base="/etc"
$ subdir="./tmp"
$ dir=$base/$subdir
$ echo $dir
/etc/./tmp
You will also see this intentional usage with the home directory in /etc/passwd; it used specially by certain programs for path substitution.

Last edited by Mr. C.; 07-30-2008 at 02:58 PM.
 
Old 07-30-2008, 02:39 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Mr. C. View Post
It means somebody concatenated two path components together
Did you fail to see the blank between the . and the following / in the original post? Or did you assume it was a typo? Or you have some other reason why it doesn't invalidate you answer?

But, so far as I understand, the command in that post does nothing, because it interprets /etc/. as /etc and cp skips directories.
 
Old 07-30-2008, 03:03 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Yes, I failed. It appeared as a single path to me. This is where a fixed-width font is useful (eg. place such text within [ code ] [ / code ] tags. Since font size/family is a browser's/user's choice, on my system the space is very hard to distinguish at 1600x1200 sitting 3 feet away from the monitor.

I knew the command would fail:

Code:
$ cp empty/. ./newdir
cp: empty/. is a directory (not copied).
so assumed the command was incomplete.

Thanks for the clarification.
 
Old 07-30-2008, 03:52 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I can't see the blank either. I wondered whether one was there and tried selecting it with the cursor tool. Since I could select it, I knew it was there. Of course I agree such things should use code tags so we can see them.

But I still have no good guess what mistake by the OP or by whatever source he copied from is responsible for the useless command.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to securing /tmp , /var/tmp and /dev/shm hackintosh Linux - Security 7 10-17-2007 11:26 PM
kde, /tmp, /var/tmp and all that garba Linux - Software 4 06-17-2005 12:31 PM
This command protects /tmp? latino Linux - Enterprise 2 08-20-2004 02:31 AM
Numerous scb_*.tmp files in /tmp dburk Programming 3 08-18-2003 04:28 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration