You are not logged in.

#1 2008-08-04 04:09:35

fflarex
Member
Registered: 2007-09-15
Posts: 466

easy question about sh/bash scripting...

What's the difference, in writing a shell script, between 'command' and 'exec command'?

Offline

#2 2008-08-04 04:39:01

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: easy question about sh/bash scripting...

From the Advanced Bash Scripting Guide (http://tldp.org/LDP/abs/html/)

exec
     This shell builtin replaces the current process with a specified command. Normally, when the shell
     encounters a command, it forks off a child process to actually execute the command. Using the exec
     builtin, the shell does not fork, and the command exec'ed replaces the shell. When used in a script,
     therefore, it forces an exit from the script when the exec'ed command terminates.

Offline

#3 2008-08-06 03:27:52

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: easy question about sh/bash scripting...

Thanks! Very useful link that definitely made it into my bookmarks.

Offline

Board footer

Powered by FluxBB