linux - In bash, what does dot command ampersand do? -


i'm trying understand bash script i'm supposed maintaining , got stuck. command of form:

. $app_location/somescript.sh param1 param2 & 

the line not being called in loop, not return code bening sent calling script somescript.sh

i know "." make process run in same shell. "&" spawn off different process.

that sounds contradictory. what's happening here? ideas?

the script running in background process, subshell, not separately-invoked interpreter without dot.

that -- current interpreter forks , begins running command (sourcing script). such, inherits shell variables, not environment variables.

otherwise new script's interpreter invoked via execv() call, replace current interpreter new one. that's right thing, because provides more flexibility -- can't run script written same shell . or source, after all, whereas starting new interpreter means other script rewritten in python, perl, compiled binary, etc without callers needing change.

(this part of why scripts intended exec'd, opposed libraries meant sourced, should not have filename extensions -- , part of why bash libraries should .bash, not .sh, such inaccurate information isn't provided kind of interpreter can sourced into).


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -