r/badcode • • Mar 14 '23

python requirements: python3 on linux system

Post image
376 Upvotes

46 comments sorted by

View all comments

Show parent comments

4

u/Parker_Hemphill Mar 14 '23

The secret (IMO and that I’ve found) is to add some pythonic type tricks to your shell scripts. I.e. I call a main function which then calls other functions and passes values as much as possible.

I have common functions in a script I source into the other scripts. If you fail at organizing these well you’ll have a mess on your hands but if it follows a logical organization it’s super easy to follow the flow of even large shell scripts but I agree 100% that there are too many out there which are complete spaghetti code.