status-react/nix/scripts/kill_proc_prompt.sh

15 lines
351 B
Bash

#!/usr/bin/env bash
set -Eeuo pipefail
# script to prompt user for terminating a process
pid="${1}"
read -p "Do you want to terminate this process? (y/n): " choice
if [[ "${choice}" == "y" ]]; then
sudo kill "${pid}"
echo "Process ${pid} terminated."
else
echo "Process not terminated. Please close it manually and retry."
exit 1
fi