All pastes #829962 Raw Edit

packaupp

public shellscript v1 · immutable
#829962 ·published 2007-12-23 17:20 UTC
rendered paste body
#!/bin/bashwhereis unrar 1>/dev/null 2>&1 || exit 0RAR="$(find "$(pwd)" -maxdepth 1 -type f -iname "*.rar"|head -n 1)"N="$(find "$(pwd)" -maxdepth 1 -type f -iname "*.r*"|egrep "r[0-9]*$"|wc -l)"ls "$(dirname "${RAR}")" > /tmp/before.$$echo "${N} archives in '"$(basename "$(dirname "${RAR}")")"'"echo -n "Extracting..."unrar e "${RAR}" 1>/dev/null 2>&1if [ $? -eq 0 ]        then                echo " done"        else                echo " failed"                exit 1firename "s/\.img/\.iso/g" *.img 1>/dev/null 2>&1ls "$(dirname "${RAR}")" > /tmp/after.$$AFTER="$(diff "/tmp/before.$$" "/tmp/after.$$"|egrep '>'|cut -b 3-)"echo "Successfully extracted '${AFTER}'"rm /tmp/after.$$;rm /tmp/before.$$