LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2007, 08:00 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Rep: Reputation: 31
[Ruby] Tar'ing or Zip'ing with ruby script


Is there anyway to pass shell commands through ruby script?

I want to be able to tar or zip files but don't want to have to create a separate script to do this and then have ruby finish the rest of the job.

Is there a way that I can insert a tar or zip command inside of my ruby script?
 
Old 01-19-2007, 06:29 PM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
Hi, sorry this is somewhat late.

The Zlib module (part of the standard library) has support for zip and gzip handling of files: http://www.ruby-doc.org/stdlib/libdo...doc/index.html

Also, the Kernel module has a method "system(cmd, [args]*)" that executes a command in a subshell: http://www.ruby-doc.org/core/classes/Kernel.html

Edit: Yay! This is my (expt 2 9)th post!

Last edited by taylor_venable; 01-19-2007 at 06:32 PM.
 
Old 01-19-2007, 06:56 PM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Thanks for the reply, I will give it a shot...
 
  


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
Subversion ruby script fails fenrisW0lf *BSD 1 12-21-2007 06:57 PM
need help with a ruby script listing directory contents Joseph Schiller Programming 4 12-31-2006 11:46 PM
cleaning the readability of this ruby script hedpe Programming 1 12-26-2006 02:46 PM
learn c++ before ruby? hottdogg Programming 13 06-17-2005 06:47 PM
Ruby help and advice Geeky_Kid Programming 5 12-31-2003 03:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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