LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-17-2010, 05: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, 03:44 PM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
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, 03:56 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I don't understand.
 
Old 07-18-2010, 10: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



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

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

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