#!/usr/bin/env bash read -p "Enter the name of the app to control: " app_name pid=$(pgrep -d ' ' -f "$app_name") if [ -z "$pid" ]; then echo "Error: Could not find a running process for '$app_name'." exit 1 fi while true; do read -p "Would you like to (P)ause or (R)esume '$app_name'? [p/r]: " action case "$action" in [pP]) pkill --signal SIGSTOP -f "$app_name" echo "Process $pid ($app_name) has been paused." break ;; [rR]) pkill --signal SIGCONT -f "$app_name" echo "Process $pid ($app_name) has been resumed." break ;; *) echo "Invalid selection. Press 'p' for pause or 'r' for resume." ;; esac done