LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   bash script: open multiple rar files (https://www.linuxquestions.org/questions/programming-9/bash-script-open-multiple-rar-files-600043/)

chief_officer 11-16-2007 01:30 AM

bash script: open multiple rar files
 
Dear friends,

I am a totally noob about the shell scripts. However, thinking that it is very painful to make recursive operations, I thought that I could write a script to execute the recursive operations.

The one that I am fed up is opening multiple rar files. They are not split archives, just dirrerent rar files.

I tried as follows:

Code:

#!/bin/bash

for i in *.rar

do
exec unrar x $i
done

This was to open all the rar files in the working directory.

However, this script only extracts the rar archive which is the first one in the directory. I mean if I have 01.rar, 02.rar, 03.rar it only extracts 01.rar and stops.

I believe there is a very small mistake I am making but I could not figure it out.

Can someone give me a hand on this?

Thanks in advance,
chief

syg00 11-16-2007 02:04 AM

Why the use of "exec" ??? - try it without.


All times are GMT -5. The time now is 11:31 PM.