#!/bin/bash # 检查包是否已安装 # 返回 0 表示已安装,非 0 表示未安装 dpkg -s "$1" 2>/dev/null | grep -q 'Status: install ok installed' exit $?