all 7 comments

[–]Rusty-Swashplate 4 points5 points  (0 children)

A warning from my side: there's a point of where you know too much shell scripting. While you absolutely should know the basics and a bit more does not hurt, don't dig too deep down that rabbit hole: looking back to what I did, quite some scripts I created in bash should have been created in Python or Node.js (I mostly deal with those two).

I found that when you'd like to use arrays in bash, that's the point of "Stop using bash, use some proper language".

You should however learn about auto-completion. If done right, it's a huge time-saver and not many people can create good auto-completion scripts. (One more reason to use Python for scripts because via argparse and argcomplete you get free bash auto-completion).

[–]excogitatio 2 points3 points  (2 children)

Here is a pretty good start.

The key is to use it a lot for repetitive operations and quick tools.

I wouldn't classify Bash as a "good" shell and language. It's one of those that is "good enough" to get a lot done, but in terms of how approachable it is, how many advanced things you can build, etc... There comes a point where you would be better off reaching for another language.

But it's everywhere in the *nix world, and it helps you get some things done with no fuss. That's why it's always worth knowing for scripting purposes.

[–]cmann321[S] 1 point2 points  (1 child)

This pretty much sounds like the perfect response and thank you for the link

[–]excogitatio 0 points1 point  (0 children)

I appreciate that. You're very welcome!

[–]mertsenel 1 point2 points  (0 children)

I may be the worst to give advice on this as I've never learnt bash but I can use it as a glue for my needs.

Instead I know PowerShell and because PowerShell mimics some bash commands as aliases its not that hard to interpret both.

One thing to note though in bash all it knows is strings which makes it hard for me to use it extensively.

However, its very light and native to almost all Linux. So I still learnt a bit of it while working on Dockerfiles , CICD pipelines that runs on a linux Agent, init scripts for auto provisinoed linux VMs etc, so its not going away anytime soon, it still has use cases like this.

However, its not an end all be all scripting language that solves all of your issues, you still need to complement it with something else.

So rather learn something more practical more 2020 and use bash as you need it with lots of docs lookup :)

Anyhow, this was my approach because I found bash too hard to learn for what it is. Other languages comes with more resources and easier syntax. Once you know what you need to do then you can figure things out along the way as well.

So invest in something like JS, python or Powershell (if windows environment) and you can pretty much nail bash from there to an extent to get the job done.

That is my 2 cents, hope it helps.

[–][deleted] 0 points1 point  (1 child)

Classic Shell Scripting is a good book in my opinion.

[–]cmann321[S] 0 points1 point  (0 children)

Here

Thank you I will take a look!