I think a lot of people don't approach "shell scripting" as "programming" but more as "a quick and dirty hack" - and there -is- a place for an ad hoc "one off" script that just gets the job done.
But I find that way too often a script that starts out that way eventually morphs into something more substantial and then you'll be glad you were a C programmer first and thought about your script as a "real" programming effort from the very start.
The phrase "Thinking in Bash" brings to mind three things, one of which may or may not be applicable in your case:
The iffy one is this: I was advised long ago, and have never been sorry for following the advice, not to program specifically in Bash but to program in "sh" so as to not get into the habit of using scripting features that may or may not be present on any given UNIX/Linux system. There are some nice features in Bash - but does this, that or the other system have Bash installed? My own systems, by default, use busybox ash, though I can load Bash easily enough when needed. I occasionally run across a script with the shabang "#!/bin/bash" instead of "#!/bin/sh" (even though it uses none of the advanced features of Bash), resulting in a message like, "sh: <script_name>: not found", when clearly <script_name> -is- present, -is- executable and -is- located in a directory mentioned in $PATH. It's enough to drive me to drinking! (*) .
I'm not saying, "never use Bash", only to use it when needed but maybe -not- to use it by default. I think (someone correct me if I'm wrong) that most systems that use Bash by default also symlink /bin/sh to point to /bin/bash and that when invoked as "sh" it will complain about "bashisms"
The second one is that to "think in bash" (or in sh) you need to "think in linux" - you need to be well versed in the unix/linux utilities - what's available, what are the available options for each, what does their output look like, the use of pipes, etc. After decades, I've only just started to get a grip on sed and awk and I realize now that I've written -a lot- of unnecessary lines of script over the years because I didn't put in the effort to learn them earlier. And don't forget regular expressions. I'd say there's actually more to it than C.
The third is to not think in C nor in Bash but to think in "Programmer". Ignoring the (possibly necessary) cancer that is "object oriented programming", you can try out a bunch of programming languages like C, pascal, etc - even BASIC and find that, while some of the features and details differ, they are enough alike that now you are thinking in that common mindset. Then treat yourself to a few weeks with each of FORTH (some of Leo Brodie's books are available on line for free) and MUMPS (gtm or O'Kane or even Intersystems Cache). Each of those will
pervert mature your "programmer mindset" just a little bit and help you to think outside your previously unnoticed box.
*) it really doesn't take all that much!
