Saved scripts vs compiled files

Hi,

A friend new to programming asked me what is the difference between a saved shell script and a compiled executable binary file?
We were talking about the difference between compiled and interpreted languages. WHen I mentioned that compiled ones produce a binary code and interpreted don't and rather execute source code line by line, she asked what about when you save a shell script and run it later. Does that mean the script was compiled?

So what is the advantage of an interpreted language if you still save the script rather than compiling it??

I tried to argue that compiled l. are faster and interpreted more convenient for immediate results because there is no time wasted in compilation. But she got me with the above question about saved shell scripts.

Clarification?

Cheers.

Mat001 wrote:
she asked what about when you save a shell script and run it later. Does that mean the script was compiled?


It is still interpreted and not compiled. When you save C/C++ code is the same: It is not compiled. Compilation is a different process than saving. Saving implies storing the data as is, meaning the language statements. Compilation implies reading the human-readable code and transforming those into processor instructions, which are then saved.

Advantage of interpreted languages? You can deploy dynamic code easier. Take Javascript as an example.
Thanks.

I'll try to get away by introducing the difference between a source code file vs a binary file.

Both types of languages have a source code text file but with difference in execution.
Topic archived. No new replies allowed.