nhc/scripts/lbnl_job.nhc: function nhc_job_find_users()
if [[ "${JOBUSERS[*]//$JOBUSER}" = "${JOBUSERS[*]}" ]]; then
JOBUSERS[${#JOBUSERS[*]}]="$JOBUSER"
fi
I can not understand why using variable substitution to check element exist in array. The trick seem to be quite meaningless and will cause misjudgement when one element is substring of another. For example:
2 user bob and bob_01 both have running jobs on a node, and nhc execute check_ps_unauth_users . When bob is checked after bob_01 , this code will think bob already exist in array and thus not count it as authorized user.
nhc/scripts/lbnl_job.nhc: function nhc_job_find_users()
I can not understand why using variable substitution to check element exist in array. The trick seem to be quite meaningless and will cause misjudgement when one element is substring of another. For example: 2 user bob and bob_01 both have running jobs on a node, and nhc execute check_ps_unauth_users . When bob is checked after bob_01 , this code will think bob already exist in array and thus not count it as authorized user.