I have been always running my following job.#!/bin/shNO_START=1STEP_SIZE=1NO_END=100DATE_STR=$(date +%m%d_%H%M%S)RUN_DIR=./$DATE_STRmkdir $RUN_DIRecho PID = $$. See $RUN_DIR/$$.log for outputs and errors.log_file=$RUN_DIR/$$.log; exec > $log_file 2>&1; datefor i in `seq $NO_START $STEP_SIZE $NO_END`do    ./c/anExternalCProgram $RUN_DIRdoneI notice today that the PID echoed is different from the one shown in top. Why is it so?
PID in top different from the $$ one?
process
To debug this, in top select ffor fields and switch on PPID by moving the cursor there and pressing Space. You might need to deselect one of the other fields (VIRT) so you can actually see this Parent Process ID.Using the PPID you should be able to tell which program invoked that shell, it is probably your program's PID, and you are actually looking at a subshell in top.