⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kill-process.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bash# kill-process.shNOPROCESS=2process=xxxyyyzzz  # Use nonexistent process.# For demo purposes only...# ... don't want to actually kill any actual process with this script.## If, for example, you wanted to use this script to logoff the Internet,#     process=pppdt=`pidof $process`       # Find pid (process id) of $process.# The pid is needed by 'kill' (can't 'kill' by program name).if [ -z "$t" ]           # If process not present, 'pidof' returns null.then  echo "Process $process was not running."  echo "Nothing killed."  exit $NOPROCESSfi  kill $t                  # May need 'kill -9' for stubborn process.# Need a check here to see if process allowed itself to be killed.# Perhaps another " t=`pidof $process` " or ...# This entire script could be replaced by#    kill $(pidof -x process_name)# but it would not be as instructive.exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -