#!/bin/bash echo "请输入两个参数:" read -a para #echo "输入参数是: " $@ #for i in para if test ${#para[@]} -ne 2 then echo "应该输入两个参数" else printf "参数比较结果: " if test ${para[0]} = ${para[1]} then echo "两个参数相等" else echo "两个参数不相等" fi fi 原文链接:https://www.f2er.com/bash/391763.html