Knowledgebase

Choosing Between Shell Scripting and a Programming Language Print

  • programminglanguages, programming, errors, guide, howto, solution, zillionkinghost, hosting
  • 0

Where the line is.

WHAT SHELL SCRIPTS DO WELL

Running commands in sequence File operations Short automation Anything fundamentally about invoking other programs

WHAT THEY DO BADLY

Complex conditions Data structures String processing beyond the simple Error handling Testing Anything maintained over years

WHAT THE SIGNS ARE THAT YOU HAVE OUTGROWN IT

Functions being defined Arrays and associative arrays appearing Substantial conditional logic Difficulty understanding your own script Length beyond a screen or two

WHAT TO MOVE TO

A general-purpose scripting language.

WHY

Better error handling, testability, data structures, and libraries.

WHAT TO KEEP IN SHELL

Thin wrappers invoking things.

WHAT TO NOT DO

Rewrite working scripts without reason.

WHAT TO DO INSTEAD

Rewrite when it next needs substantial change.

WHAT TO ALWAYS ADD REGARDLESS OF LANGUAGE

Logging Failure handling Safety to run twice A way to test without causing damage


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot