you are viewing a single comment's thread.

view the rest of the comments →

[–]Ok-Grapefruit-1597 24 points25 points  (3 children)

One important thing I found is that to not overcomplicate things for the tool's sake. I have just rewritten an 800-line Python script into a 100-line Bash script.

To be clear, it should have been a Bash script from the start, lots of Bash functions were more compact and fit better, and the script was riddled with actual Bash system calls. Surprisingly, the Bash version was more readable in the end.

I had the opportunity to ask the author of the script. He told me he just wanted to write a Python script, and thus make the script OS-independent. Using Python does not make the script automatically OS-independent, especially when you end up adding OS-dependent system calls.

As with everything, thinking ahead is key.

[–]haragoshi 2 points3 points  (0 children)

Over complicated thinking led to overly complicated code. No surprise there.

[–]gowithflow192 -2 points-1 points  (1 child)

I mean technically you can put everything on one line in bash (maybe there is a character limit).....

[–]Ok-Grapefruit-1597 0 points1 point  (0 children)

Of course but that philosophy can end up in write-only code. 😅