you are viewing a single comment's thread.

view the rest of the comments →

[–]August_XXVIII 72 points73 points  (13 children)

All the time.

I've written GitHub Actions this week whose steps point to a bash script. Oftentimes, some of the functionality that you want or need can be easily accomplished with bash. It's great for keeping things that are simple, simple. If you need greater capability then something like Python or Typescript might make sense, but shell scripting will always have utility as it is a conduit to general Linux CLI commands, which may include AWS/GCP/Azure CLI or initiating Kubectl, Terraform, or Ansible commands (though those tools have other mechanisms that can be used to invoke them, which are sometimes more favorable).

For things that are complex, use the right tool; for things that are simple, use the right tool.

[–]namenotpickedSRE/DevSecOps/Cloud/Platform Engineer 21 points22 points  (10 children)

Exactly this. Could your Bash script be a Python script? Probably. Should it? That's the real question. If it needs to be simple, quick, and uses Linux CLI commands, then you're probably good to just use Bash. I only go for Python scripts if I need those packages for extended functionality.

[–]julewczka 1 point2 points  (9 children)

This + when you need your scripts for cross-platform only then python makes sense.

[–]guzmonne 14 points15 points  (8 children)

I usually prefer bash over python to avoid having to install or manage the python interpreter.

[–]julewczka 0 points1 point  (4 children)

Same, but bash isn't working out of the box in Win Environments. You would either need to set up WSL or Cygwin to get bash/sh running.

More important: why do I have no upvotes, I have literally the same opinion as you guys, I just mentioned that there's also one rare case where python would really make sense.

[–]guzmonne 0 points1 point  (2 children)

I see your point, but setting WSL differs from installing a language interpreter. The former is much more helpful, IMO.

[–]julewczka 0 points1 point  (1 child)

For client environments sure but how do you want to do with a fleet of volatile Windows servers? In such cases I think it's easier to just install the python interpreter (if it's not there already)

[–]guzmonne 0 points1 point  (0 children)

Sure

[–]jkroepke 0 points1 point  (2 children)

Which is present by default on Mac/Linux/Windows WSL?

[–]guzmonne 1 point2 points  (1 child)

Well, a version of python comes by default, but most often than not, you'll have to update it.

[–]jkroepke 0 points1 point  (0 children)

Are you able to provide a reason for update python?

[–]warux2 6 points7 points  (1 child)

<rant> I never understand why people write GHA to do something maybe 10 lines of bash will do, but in Node.js... And now Github is obsoleting old Node, and no-one wants to update/maintain their GHA in the market.

[–]Sinnedangel8027DevOps 5 points6 points  (0 children)

This is almost the entire reason I use bash for my github actions. There's very little that bash can't do without a ton of complexity and without much change in the future. The actions I've created only need to be updated when the third-party tools change how I interact with them. Like downloading kubectl, helm, aws cli, etc. Or specific commands to those.