LinuxQuestions.org
Visit the LQ Articles and Editorials section
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, 09:00 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora 14
Posts: 367

Rep: Reputation: 30
[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, 07:29 PM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 41
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 07:32 PM.
 
Old 01-19-2007, 07:56 PM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora 14
Posts: 367

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


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


All times are GMT -5. The time now is 11:37 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration