News for hackers. Stuff that matters.
Re:Better bash in 15 minutes by xrt on Wednesday April 16, 2014 @02:48PM (#7599700)
I really hate writing things in reverse, but a decent style in Bash is to put everything in functions, w/ a main() at the top:

    #! /usr/bin/env bash
    set -e -u
    bar='bar'
    
    main() {
      foofunction
    }
    
    foofunction() {
      echo 'foo'
      echo $bar
    }

    main "$@"

There are no comments on this comment yet.