3 ms·
For me, the difference is the notion of "procedure" : * scripts are a sequence of of parametrized commands. It's the list of interactives shell commands stored
by olivierduval 3y ago
For me, the difference is the notion of "procedure" :
* scripts are a sequence of of parametrized commands. It's the list of interactives shell commands stored in a text file
* programs are everything else : as soon as there's a function/procedure definition inside a file, it's a program
In a way, it's all about control flow and recursivity : script can't be recursives (like a function calling itself) so it's usually less complex
It might seem arbitrary but we've all seen :
* bash "scripts" with functions inside the script is a program (but a bash script calling another bash script is not, as the called bash script is just considered a command)
* python "programs" without any procedure are actually scripts
In the end, scripts are just some kind of macro, used to repeat some finite sequence of actions (with parameter if necessary). They don't provide enough "power" to be compared to a program... and because of that, they are easier to read, modify
But YMMV