check.sh
                        
                             · 907 B · Bash
                        
                    
                    
                      
                        Brut
                      
                    
                      
                    
                        
                          
                        
                    
                    
                
                
                
            #!/usr/bin/env bash
set -euo pipefail
# 要检查的命令列表(包含常用的系统管理、文件操作、网络诊断等)
cmds=(
  # 原有命令
  ls type which make uname lsb_release
  lspci lsusb lsblk fdisk df free top htop ip ping curl wget
  zip unzip xargs tar time zstd ssh adduser ufw man
  mount umount systemctl journalctl dmesg hostname hostnamectl
  cat echo grep awk sed cut find ps less kmod iptables ip6tables
  netstat ss route tcpdump du chmod chown cp mv rm mkdir rmdir ln touch
  useradd userdel groupadd groupdel passwd su sudo env uname whoami
  uptime date lsof vmstat iostat traceroute host dig
  tail head watch logger crontab ifconfig
)
for cmd in "${cmds[@]}"; do
  if ! command -v "$cmd" >/dev/null 2>&1; then
    echo "ERROR: Required command '$cmd' not found in \$PATH!" >&2
    exit 1
  fi
done
echo "✅ 系统健康检查通过:所有常用命令都可用。"
                | 1 | #!/usr/bin/env bash | 
| 2 | set -euo pipefail | 
| 3 | |
| 4 | # 要检查的命令列表(包含常用的系统管理、文件操作、网络诊断等) | 
| 5 | cmds=( | 
| 6 | # 原有命令 | 
| 7 | ls type which make uname lsb_release | 
| 8 | lspci lsusb lsblk fdisk df free top htop ip ping curl wget | 
| 9 | zip unzip xargs tar time zstd ssh adduser ufw man | 
| 10 | mount umount systemctl journalctl dmesg hostname hostnamectl | 
| 11 | cat echo grep awk sed cut find ps less kmod iptables ip6tables | 
| 12 | netstat ss route tcpdump du chmod chown cp mv rm mkdir rmdir ln touch | 
| 13 | useradd userdel groupadd groupdel passwd su sudo env uname whoami | 
| 14 | uptime date lsof vmstat iostat traceroute host dig | 
| 15 | tail head watch logger crontab ifconfig | 
| 16 | ) | 
| 17 | |
| 18 | for cmd in "${cmds[@]}"; do | 
| 19 | if ! command -v "$cmd" >/dev/null 2>&1; then | 
| 20 | echo "ERROR: Required command '$cmd' not found in \$PATH!" >&2 | 
| 21 | exit 1 | 
| 22 | fi | 
| 23 | done | 
| 24 | |
| 25 | echo "✅ 系统健康检查通过:所有常用命令都可用。" | 
| 26 |