Removing Files after Successful Extraction unrar rm shopt globstar
It should work with removing the double quotes:

shopt -s globstar
for f in **/*.rar; do
    dir=`dirname "$f"`;
    unrar e "$f" "$dir" &amp;&amp; rm -frv ${f::-2}*;
done




Bash expansion of the star char * doesn't occurs inside quotes.

For example:

echo dir/*.rar might give:

dir/file1.rar
dir/file2.rar
dir/file3.rar


But echo "dir/*.rar" will give:

dir/*.rar


(rm command will try to delete a filename which contains literally a star character.)