LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-08-2005, 06:52 PM   #1
thebored
LQ Newbie
 
Registered: Mar 2005
Posts: 23

Rep: Reputation: 15
Escaping "-" at the beginning of a file!


I'm trying to cp a file that begins with a "-".
But if I try to escape it by doing
cp \-\ blahblah.txt /var/ftp/
I get an error from cp saying I passed an illegal operation. I also tried doing
cp '- blahblah.txt' /var/ftp/
but to no avail. I'm using bash btw.

Any help?

-HK
 
Old 04-08-2005, 06:56 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Use '--' (dash dash) to signify the end of options, as in:

cp -- -this that
 
Old 04-08-2005, 06:58 PM   #3
thebored
LQ Newbie
 
Registered: Mar 2005
Posts: 23

Original Poster
Rep: Reputation: 15
Ok, thanks! That worked.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 01:19 AM
renaming file names beginning with "-" prashln Linux - General 5 05-01-2010 01:47 AM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
How to fix the "login" window in the beginning, in mangrake 9.2 ? freaker2k5 Linux - General 0 09-22-2004 05:47 AM
Can't locate object method "splitpath" via package "File::Spec" RobJohnston Linux - General 2 06-28-2003 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:39 PM.

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