Know your shell. Your loop might not make sense. Be certain which shell you are using, as you tagged both the Bourne shell (sh
) and the Korn shell (ksh
).
source
is not native to Korn-shell but is native to other non-Korn shells, such as csh
and bash
.
On pdksh or with some distros, source
may just be an alias for the Korn shell built-in command .
which executes the specified script (or function) within the current environment . (i.e. no separate PID, and consequently synchronous execution).
If you want to start a separate environment (i.e. a separate process, different PID) you must omit the source
and append a single ampersand (&) to the end of the command line. It is the ampersand that tells Korn shell to start a separate process and within that process to run your script asynchronously (not wait for it to complete).
So if you want to run two separate command lines as concurrent tasks (i.e. async), each must have a &
as the last character on the line.
$ab
, and thesource
command suggests that this is not runningksh
at all. – tripleee Oct 23 '20 at 8:30sh
also does not havesource
, and also not arrays. We still can't tell what the scripts do, but backgrounding things which need to be run in the same process obviously doesn't work. (The operator to background something is&
, not&&
.) – tripleee Oct 23 '20 at 8:59