Tidy shell script source file

Hi all,

Is there a tool to tidy up shell script source file and reformat it. Preferably I am looking for a perfect tool to do this.

Also I have heard it is possible to do with emacs editor but unfortunately it is looking very different and new from vi. Emacs is new to me and I could not find such an option myself yet.

Thanks,
meharo

Here is a pointer to a Bash script beautifier written in Ruby: Bash Script Beautifier