arfoll / unrarall

bash script to unrar everything and cleanup in a given directory
GNU General Public License v3.0
261 stars 68 forks source link

Mac sed, the special snowflake... #33

Closed coraxx closed 7 years ago

coraxx commented 7 years ago

First of all, thank you for this awesome script! I appreciate it a lot :D

I just wanted to share a fix for my problem, that I'm pretty sure has to do with sed on my Mac Os X 10.10.5 installation. The rar cleanup doesn't work correctly because it only deletes the first rar of a multi rar archive, so e.g. only archive.part01.rar with all of the rest not removed.

I was able to pin down the problem to line 612:

sfilename=`echo "$sfilename" | sed 's/\.part[0-9]\+$//'`

I changed it to

sfilename=`echo "$sfilename" | sed 's/\.part[0-9]*//'`

I just googled it quickly and found something like that. TLDR:

On OSX, sed by default uses basic REs. You should use sed -E if you want to use modern REs, including the "+" one-or-more operator. by paxdiablo

So nothing dramatic, just thought to share my insights :)

Take care and keep up the nice work,

J

delcypher commented 7 years ago

@Splo0sh Thanks.

I'm guessing something like

sfilename=`echo "$sfilename" | sed 's/\.part[0-9][0-9]*$//'`

might work? Could you test it and if it works could you create a PR?

delcypher commented 7 years ago

@Splo0sh Thanks for reporting. This is fixed by 17ed2580f428b405e293ac925a9a2aca0f2edc43

coraxx commented 7 years ago

@delcypher any time. Thanks for the fix 👍