Job-control commands report whether background work is running or stopped. A small table can model the decision without launching jobs.

Program

Play the script to choose a job name and read its modeled status.

job_status_table.sh
#!/usr/bin/env bash

selected_job=
build_status="running"
deploy_status="stopped"
if [[ "$selected_job" == "build" ]]; then
    status="$build_status"
else
    status="$deploy_status"
fi
echo "$selected_job:$status"
#!/usr/bin/env bash

selected_job=
build_status="running"
deploy_status="stopped"
if [[ "$selected_job" == "build" ]]; then
    status="$build_status"
else
    status="$deploy_status"
fi
echo "$selected_job:$status"
job status Interactive Bash can show whether jobs are running, stopped, or done.
modeled table A fixed table avoids depending on real background process timing.
conditional selection The `if` branch copies the selected job's status into one output variable.