Code:
#!/bin/bash
array=$*
for ext in $array; do
find /home -iname '*.$ext' -exec rm -f {} \;
done
This is a really simplistic solution.
Save it as script.sh and make it executeable, chmod +x script.sh.
To use it do something like this:
./script.sh mp3 mpg wma
This will execute 3 finds that can be translated like this.
find /home -iname '*.mp3' -exec rm -f {} \;
find /home -iname '*.mpg' -exec rm -f {} \;
find /home -iname '*.wma' -exec rm -f {} \;
This happens because 'for' shifts each word seperated by a whitespace character (in this case it's a space) and sets $ext to the current itteration.
$* is just a way to print all arguments passed from the command line.
The $array variable will look like this:
Code:
array="mp3 mpg wma"
Best regards
Fredrik Eriksson