LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 01: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, 02:04 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 03:29 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
[ 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 03:58 PM.
 
Old 07-30-2008, 03:39 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
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, 04:03 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
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, 04:52 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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-18-2007 12:26 AM
kde, /tmp, /var/tmp and all that garba Linux - Software 4 06-17-2005 01:31 PM
This command protects /tmp? latino Linux - Enterprise 2 08-20-2004 03:31 AM
Numerous scb_*.tmp files in /tmp dburk Programming 3 08-18-2003 05:28 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 02:03 PM

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

All times are GMT -5. The time now is 11:41 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration