. /etc/rc.conf . /etc/rc.d/functions in_array() { local needle=$1; shift [ -z "$1" ] && return 1 # Not Found local item for item in "$@"; do [ "$item" = "$needle" ] && return 0 # Found done return 1 # Not Found } echo ${DAEMONS[@]} for daemon in $(/bin/ls -1t /var/run/daemons); do if ! in_array $daemon ${DAEMONS[@]}; then echo $daemon fi done