Code:
for video in *.mpg *.avi *.wmv; do
echo "${video%.*}.flv"
ffmpeg -i "$video" "${video%.*}.flv"
done
Read through "3.5.3 Shell Parameter Expansion" in the "info bash" manual. Using parameter expansion will be a lot faster, and when you get used to it, easier.
Some commands like test are bash built in commands and will run a lot faster using them compared to running an external command. You can also get quick help on using them by entering "help <builtin>" in the console.
This simple segment demonstrates a test. The spaces just inside the square brackets are manditory. An earlier "sh" shell didn't have [ as a built in so it is command, and is in /bin/[ as well as being a built-in. If you omitted the first space, bash would look for the command "[-f". Not what you wanted.
Code:
for file in *; do
[ -f "$file" ] || continue
echo $file
done
I didn't look at the ffmpeg command itself.