Your sample script is a bit heavy for a simple conversion.
The following should do just as well
Code:
convert PleaseConvertMe.jpg /home/userid/imagecache/output.png
convert PleaseConvertMe.jpg /home/userid/imagecache/output.gif
Or if you're converting the same image into 2 formats, this might even work:
Code:
convert PleaseConvertMe.jpg /home/userid/imagecache/output.{png,gif}
The second one might not work, depending on how convert works.
Edit: Apparently the second one doesn't work...I just tested it and got an error