2

From this article:

Sourcing will execute the commands in the current shell, executing will create a new shell and execute the commands there.

He describes that each shell has its own PID. I don't see any difference between the word shell and process, at least not for how the word shell is used in his context.

Bentley4
  • 1,998

2 Answers2

6

A (running) shell is a process but not all processes are shells.

All running applications and daemons are processes. The only thing running which is not a process is the kernel (including kernel threads). The kernel, at least on Unix like OSes is launching one (or more) initial hand crafted processes, usually called init. These processes are the parents of a whole hierarchy of other processes. When you run the ps or the top command, you'll see each process with its own distinct PID.

When you log in to a terminal emulator, you are launching an interactive shell, for example sh, dash, ksh, bash, zsh and the likes. These shells are interpreting the commands you are typing in the terminal window, for example ls, cat and date. The latter are not shells but executable binaries.

You can also run shell scripts, which are text files containing commands to be executed by a shell.

As not all programs are shell scripts or interactive shell sessions, you cannot say shell is synonymous of process.

jlliagre
  • 14,369
4

No. A shell is a kind of program.

And in context the writer is talking about processes executing that particular type of program: shell processes. That sentence is simply written in an abbreviated form (and missing a conjunction, too). It could have been written:

Sourcing a script will execute the commands in the current shell process, whereas executing a script will spawn a new shell process and execute the commands there.

It was written in a context where it was clear that shells — the Bourne Again shell specifically —, scripts, and processes were the subjects of discussion. Context is important here.

shell is part of the operating-system-as-a-nut metaphor.

Further reading

JdeBP
  • 27,556
  • 1
  • 77
  • 106