LINUX.ORG.RU

История изменений

Исправление Kroz, (текущая версия) :

Проверить нет возможности, но, думаю, смысл поймешь.

#!/bin/bash
DIR=('/home/user/Downloads/')
TEMPLATE=( '*.deb' '*.save' )
tempfile=$(/bin/mktemp)
file=$(/bin/mktemp)

excl=""
for i in ${TEMPLATE[*]}
do
  [[ -n $excl ]] && excl="${excl} -and"
  excl="{$excl} -not -name ${i}"
done

for j in ${DIR[*]}
do
  command="find ${j} -type f ${excl} -exec md5sum {} + >> ${tempfile}"
  bash -c "${command}"
done

P. S. Может "-and" не нужно

Исходная версия Kroz, :

Проверить нет возможности, но, думаю, смысл поймешь.

#!/bin/bash
DIR=('/home/user/Downloads/')
TEMPLATE=( '*.deb' '*.save' )
tempfile=$(/bin/mktemp)
file=$(/bin/mktemp)

excl=""
for i in ${TEMPLATE[*]}
do
  [[ -n $excl ]] && excl="${excl} -and"
  excl="{$excl} -not -name ${i}"
done

for j in ${DIR[*]}
do
  command="find ${j} -type f ${excl} -exec md5sum {} + >> ${tempfile}"
  bash -c "${command}"
done