Exec may refer to any of the following:

  1. With a command line, like Linux or Unix, exec is a BOURNE and POSIX shell command that replaces the current shell process with the command after exec. This command does not create a new PID. For example, if you were to run exec , the shell would be replaced by that command. When that command is exited, the shell will exit.

  2. When referring to a programming or scripting language, such as C, Perl, or PHP, exec is a function that executes a program. For example, in Perl, you could use the following line to print the files in the current directory on a Linux system.

If you’re trying to execute a script or program, type ./ in front of the script or program; don’t use “exec”.

exec “ls”

  1. With an SSI (server-side include), the exec command is used to execute a command on the server and display the output to the web page. For example, if we wanted to display the same output used in the above example on a web page using SSI, you could use a command similar to the following example.
  • Bash exec builtin command.

Command, Execute, Fork, PID, Programming terms