Bash Script Beautifier

Bash (Unix shell)
Image via Wikipedia

Today I was working on a bash script written by someone else. And the script was maintained since long and had actually become quite big and there was no indentation followed. So, you can understand how difficult it was to understand the script. So, I set my foot forth to first find a beautifier for the bash script before I fixed it and my search ended here.

http://www.arachnoid.com/linux/beautify_bash/

Hope this helps you too 🙂

Enhanced by Zemanta

2 thoughts on “Bash Script Beautifier”

  1. I had same quest and had run into same link from back in 2008. I download ruby and the script to discovery it really don’t work. I get following error:

    $ /usr/local/bin/beautify_bash.rb getimages_fixed_1.sh
    /usr/local/bin/beautify_bash.rb:54: warning: character class has duplicated range: /.*<<-?\s*['|"]?([_|\w]+)['|"]?.*/
    /usr/local/bin/beautify_bash.rb:45:in `beautify_string': undefined method `each' for # (NoMethodError)
    from /usr/local/bin/beautify_bash.rb:139:in `beautify_file’
    from /usr/local/bin/beautify_bash.rb:157:in `block in main’
    from /usr/local/bin/beautify_bash.rb:156:in `each’
    from /usr/local/bin/beautify_bash.rb:156:in `main’
    from /usr/local/bin/beautify_bash.rb:166:in `’

    Any clue?