bash - Bash Shell: close all windows and programs UNIX
问题描述
How would I make a script to exit all programs and windows using bash shell commands and automator on a unix machine?
without using an extra program such as
xdotool search "" windowkill %@
解决方案
尝试这个:
#!/bin/bash
command=$(ps aux | awk '{print $1,$2}' | grep $USER)
for i in $command; do
kill -9 ${i};
done
推荐阅读
- azure-active-directory - 获取仅限于请求应用程序的用户的应用程序角色
- ruby-on-rails - 如何阻止门卫重定向,而是向我显示 oauth/authorize 视图?
- javascript - 如何使用 React 路由将状态从父组件传递到子组件?
- java - 在 Java 程序中运行可执行 JAR 后如何删除它?
- django - Django 从一个视图重定向到另一个 WITH PARAMETERS
- php - 升级到 php8 后 Composer 版本锁定问题
- python-3.x - 将空格分隔的数据添加到从 tkinter 中的输入框读取的列表中
- python - 为什么我不能在 Ubuntu 20.04 LTS 中使用 Pyautogui?
- json - 如何在 Flutter GetX 中使用 observable 方法处理复杂的 API 数据响应
- java - 在 Java 中序列化并在 C++ 中读取