DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th December 2008
michaelrmgreen's Avatar
michaelrmgreen michaelrmgreen is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 49
Default hahaha noob mistake, file called -z...

Well the command line looked ok according to the man page...

# tar -c -f -v -z parkrow.tz *.dbf

Result? Giant file called -z. Oh how I laughed...

I tried

# rm -i *

error message about illegal option --z

How does I remove, daemonforum, how?

Last edited by michaelrmgreen; 5th December 2008 at 02:18 PM. Reason: typo
Reply With Quote
  #2   (View Single Post)  
Old 5th December 2008
arch arch is offline
Port Guard
 
Join Date: Jun 2008
Posts: 38
Default

Code:
NOTES
     The rm command uses getopt(3) to parse its arguments, which allows it to
     accept the `--' option which will cause it to stop processing flag
     options at that point.  This will allow the removal of file names that
     begin with a dash (`-').  For example:

           rm -- -filename
__________________
Verbose mode can also be turned on for SSH2 with the (surprise!) VerboseMode keyword.
Reply With Quote
  #3   (View Single Post)  
Old 5th December 2008
michaelrmgreen's Avatar
michaelrmgreen michaelrmgreen is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 49
Default

Thank you very much Mr Arch, just what I needed.
Reply With Quote
  #4   (View Single Post)  
Old 5th December 2008
anomie's Avatar
anomie anomie is offline
Local
 
Join Date: Apr 2008
Location: Texas
Posts: 445
Default

You already have a good answer, but another solution is simply:
% rm ./-z
__________________
Kill your t.v.
Reply With Quote
  #5   (View Single Post)  
Old 5th December 2008
DutchDaemon's Avatar
DutchDaemon DutchDaemon is offline
Real Name: Ben
Spam Refugee
 
Join Date: Jul 2008
Location: Rotterdam, The Netherlands
Posts: 336
Default

By the way, the options to tar don't need hyphens, so you can use
Code:
tar cvzf filename.tar.gz
and
Code:
tar zxvf filename.tar.gz
Reply With Quote
  #6   (View Single Post)  
Old 6th December 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Default

important to save that keystroke
__________________
"No, that's wrong, Cartman. But don't worry, there are no stupid answers, just stupid people." -- Mr. Garrison

Forum Netiquette
Reply With Quote
  #7   (View Single Post)  
Old 8th December 2008
michaelrmgreen's Avatar
michaelrmgreen michaelrmgreen is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 49
Default

The man page : http://www.freebsd.org/cgi/man.cgi?q...SE&format=html

The 'bundles flags' option is for backwards compatibility. Examples are shown in the '@archive' section like this : 'tar -c -f'. Somewhere (I can't find it now) it says that the parameters for the flags have to be in the same order as the flags, but I can't find anywhere that it says that the last flag befor the archive name has to be the 'f' flag, hence my creation of the '-z' file (ie. tar -c -f -z arch.tz *.dbf -> file called -z).

If the man pages were a Wiki I'd edit the line for -f to say that it should be the last argument before the archive file name.

--
FreeBSD fan and user. Dentist by profession. I work here : http://theparkrowdentalpractice.co.uk/

Last edited by michaelrmgreen; 24th June 2011 at 11:01 AM. Reason: Experimental sig added.
Reply With Quote
  #8   (View Single Post)  
Old 8th December 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

I was going to make an example, but I just realized that OpenBSDs tar doesn't suport @archive like FreeBSDs does.... lol.


looking at the FreeBSD manual page:

Code:
tar -c -f - newfile @original.tar
if original.tar contains the files oldfile1 and oldfile2; it will write an archive to standard output (-f -) containing newfile, oldfile1, and oldfile2. @archive just means, when parsing the list of files to archive, if you [tar] see @file.tar in the files list, open file.tar, and append it's contents to my new tape archive, rather then archiving file.tar.

Thus, if tar's new option parser supports it, these commands should be equivalent:

Code:
tar -c -f new.tar newfile @original.tar
tar -cf new.tar newfile @original.tar
tar cf new.tar newfile @original.tar
the f in bundled flags means to use the FIRST file in the file list as the archive to operate on; unless b was specified first in which case it uses the 2nd file ref.


Personally, if it's not one of the c, x, f, v, t, u, or r flags, I don't bundle them.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #9   (View Single Post)  
Old 9th December 2008
robbak's Avatar
robbak robbak is offline
Real Name: Robert Backhaus
VPN Cryptographer
 
Join Date: May 2008
Location: North Queensland, Australia
Posts: 366
Default

Quote:
Originally Posted by michaelrmgreen View Post
If the man pages were a Wiki I'd edit the line for -f to say that it should be the last argument before the archive file name.
Well - It does say that: In the synopsis at the top
Quote:
tar {-r | -u} -f archive-file [options] [files | directories]
the -f is listed with the filename after it, and in the description,
Quote:
-f file
again -f is listed with the file. This is the way this sort of thing is written in every man page.
So I guess the next thing to check is that man(1) is right! (as if anyone actually reads these things.
__________________
The only dumb question is a question not asked.
The only dumb answer is an answer not given.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP read file contents - Maximum file size cksraj Programming 1 21st September 2009 11:38 AM
DMZ zone - I can't find a mistake... maurobottone OpenBSD Security 23 11th January 2009 11:27 PM
Noob: Updating To OpenBSD-Stable. MetalHead OpenBSD Installation and Upgrading 3 11th November 2008 02:06 AM
Unix noob's license plate drhowarddrfine Off-Topic 16 20th September 2008 04:57 PM
file:/// mfaridi FreeBSD Security 3 27th July 2008 02:18 PM


All times are GMT. The time now is 09:57 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick