LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Bash scripting (http://www.linuxquestions.org/questions/programming-9/bash-scripting-153551/)

JonCooperUK 03-04-2004 03:54 PM

Bash scripting
 
Hi all,

I'd like to be able to create a bash terminal script that will convert an ace compressed archive to a rar. Is this possible? Something that works like:

ace2rar myfile.ace myfile.rar

Thanks in advance for any pointers

Tinkster 03-04-2004 05:24 PM

Quote:

I'd like to be able to create a bash
terminal script that will convert an
ace compressed archive to a rar.
Is this possible?
Yes ;}

Of course you need to buy both programs ...


Cheers,
Tink

jschiwal 03-04-2004 08:16 PM

I've never heard of an ace archive. Do you have a program that will uncompress such an archive? You can download a tarball for rar on the net and compile it. Then your script will take the two parameters and use them in a line which pipes the stdout of the ace decompressor and pipes it into rar. If you look at the man pages for rar, tar and cpio, they should supply models you could build on to write your script.

Your hardest part may be in error correction. You might want to use the 'file' command to verify the the file input is an .ace or .rar file before attempting to perform the conversion.

You could write the stript to be able to convert either way and check $0 to see if it was called as ace2rar or rar2ace or ace2tgz, whatever. Then use the case selector to perform the conversion needed.

Tinkster 03-04-2004 08:55 PM

Quote:

Originally posted by jschiwal
I've never heard of an ace archive. Do you have a program that will uncompress such an archive?
Winace http://www.winace.com is a pretty good
windows compression tool ...


Thing is that both ace and rar only have free
UN-archivers for Linux for all I know, which makes
the tool quite hard to implement, I guess :}

maybe two scripts, ace2bz2 and rar2bz2? ;)


Cheers,
Tink


All times are GMT -5. The time now is 08:29 AM.