#!/bin/bash # cd /etc for a in *;do if [ -L $a ];then #若是文件存在,为软连接文件且指向的是文件,则返回真 echo $a fi done
测试:bash