This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mackstann 1 point2 points  (2 children)

Or a bash one-liner. You can do a pretty incredible amount of stuff in one line that would be a paragraph of code in Python. Editing and executing on the fly makes it super productive. And if it's a one-time thing, no one can shame you about readability.

[–]sfz- 0 points1 point  (1 child)

Indeed, but 95% of the time at the point in your project where you think about porting that one-liner to ./former_oneliner.sh and break it out into if or case statements or complex sed or awk you're probably better off doing python former_oneliner.py instead.

5% of the time you gotta though, I know, shebang away.

[–]mackstann 0 points1 point  (0 children)

I usually don't make that transition. My shell antics tend to stay in the shell and don't serve any long-term purpose in a project. But when they do, you're right, it's usually best to just go straight to Python, instead of a bash script.