Timeline for Why write an entire bash script in functions?
Current License: CC BY-SA 3.0
        5 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 3, 2016 at 7:50 | comment | added | Hastur | 
        
            
    @Xalorous I've seen a practices where global variables are  Initialized  in a procedure, as an intermediate and quick step before the developing of a procedure that reads their value from an external file... I agree it should be cleaner to separate definition and initialization but seldom you have to bend to undergo to the advantage number 3 ;-)
        
     | 
|
| Sep 30, 2016 at 11:52 | comment | added | Jeter-work | What needs to be divided into functions should be, but the example takes it too far. I think the only one that really bugs me is the variable declaration function. Global variables, especially static ones, should be defined globally in a commented section dedicated to that purpose. Dynamic variables should be local to the functions that use and modify them. | |
| Sep 29, 2016 at 23:42 | comment | added | Charles Duffy | I'd argue that it's sometimes sensible to model and enforce those dependencies, vs refactoring to avoid them (since if there are enough of them, and they're sufficiently hairy, that can just lead to a case where things are no longer modularized into functions at all). A very complicated use case once inspired a framework to do just that. | |
| Sep 29, 2016 at 22:03 | history | edited | John1024 | CC BY-SA 3.0 | 
        
            
             
                
                    added 26 characters in body 
                
             
        
     | 
| Sep 29, 2016 at 21:44 | history | answered | John1024 | CC BY-SA 3.0 |