Currently I have listed down learning Unix/Shell Scripting and reading CLR Algo book as the most important priority for me. I was thinking if I could solve the algorithms questions mentioned in CLR using shell scripting. Mind you I’m a complete newbie to Unix/Shell Scripting.
Currently I have listed down learning Unix/Shell Scripting and reading CLR Algo book as
Share
No, it’s not. Shell scripting is definitely not designed for writing algorithms. You should use a general-purpose programming language like C, C++, Java, Python, or [insert your favorite general purpose language here].
That’s not to say that you couldn’t use bash or something for algorithms — it’s Turing-complete AFAIK — but you really wouldn’t want to. It’d be a huge pain, you wouldn’t learn a lot of the skills you need (like modeling algorithms in common programming languages or styles), and your solutions would be cryptic. Do yourself a favor and use something else. Shell scripting is for automating tasks, not solving algorithms.
Also, most shell script languages (bash most notably) are weakly typed, which a.) hurts performance and b.) will make your program harder to reason about. Dynamic typing is OK for algorithms, weak typing, not so much. Performance will be abysmal, regardless.
If you’re trying to learn both shell scripting and algorithms, you can still do it at the same time. Write scripts to compile and test your programs and write your programs in a general purpose-language.