LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-17-2010, 06:09 AM   #1
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Rep: Reputation: 31
bash command has invalid option


Hi,

I'm trying to run a command from an ubuntu howto page, but there's something wrong with it that i dont understand?

Can you point it out please?

Thanks

root@nnjond-desktop:/# tar -cvpzf backup.tar.gz -–exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /
tar: invalid option --
Try `tar --help' or `tar --usage' for more information.
root@nnjond-desktop:/#
 
Old 07-17-2010, 04:44 PM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi.

Looking at it with plain cat:
Code:
% cat t1
-–exclude=/backup.tar.gz
but with option -A:
Code:
% cat -A t1
-M-bM-^@M-^Sexclude=/backup.tar.gz$
so you have a non-standard dash. Replace that and you should be able to get past this problem ... cheers, makyo
 
Old 07-17-2010, 04:56 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
I don't understand.
 
Old 07-18-2010, 11:31 AM   #4
jackstevens
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by MTK358 View Post
I don't understand.
It appears you have some non-printing characters in your script, such as the control-S.

You thought you only typed "-–exclude=/backup.tar.gz" What you actually typed, as shown by the "cat -A (show all)" command is "-^Sexclude=/backup.tar.gz$" where that "^S" is the printed representation of a control-S. Once the line parser hit that, all it sees is the double-dash, which is an invalid option, and not the double-dash-exclude.

That's an easy enough mistake to make; I know I accidentally put non-printing characters in with annoying regularity.
 
  


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
[SOLVED] vgdisplay -v -D results in invalid option -D in rhel 5.5(tikanga) hartajdugal Linux - Newbie 6 07-16-2010 11:57 AM
ls *txt* returns invalid option --e Eh ??? MrMark Linux - Newbie 5 02-15-2007 08:57 PM
dkmraid -i invalid option sang_froid Linux - General 0 10-16-2006 09:50 AM
cp indicates invalid option Murdock1979 Linux - Software 1 01-24-2006 03:21 AM
in.telnetd: invalid option -- L implant23 Linux - Networking 1 12-01-2002 12:17 PM


All times are GMT -5. The time now is 06:45 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