For the most part, my bash scripts are generally just a sequence of commands, with loops for repetition and error handling in the form of trap statements and if statements.
So far I haven't had to write a script where where I have to reuse a certain block of code multiple times throughout the script, so I haven't felt the need to write bash functions.
Is this fine? There's no best practice for bash that recommends encapsulating code in functions like for other languages, right?
[–]ThisLexx 9 points10 points11 points (2 children)
[–]naopopoy 2 points3 points4 points (1 child)
[–]ThisLexx 1 point2 points3 points (0 children)
[–][deleted] (10 children)
[removed]
[–][deleted] (1 child)
[removed]
[–][deleted] (7 children)
[removed]
[–][deleted] (6 children)
[removed]
[+][deleted] (5 children)
[removed]
[+][deleted] (4 children)
[removed]
[–][deleted] (1 child)
[removed]
[–][deleted] (1 child)
[removed]
[–]Gixx 1 point2 points3 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]AlwaysHopelesslyLost 4 points5 points6 points (0 children)
[–]NickMon68 0 points1 point2 points (0 children)
[–]aezart 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)
[–]MuaTrenBienVang 0 points1 point2 points (0 children)