I use a script that consumes a lot of ram memory to such an extent that it freezes my computer and gives an error.
How could you limit the memory usage of this particular script?
I use debian 9 (linux)
thanks.
this is the basic script
path="/home/xxx"
mesMenosUnDia=$(date +%m --date='-1 month')
fecha=$(date +"%Y-$mesMenosUnDia-%d")
echo "find"
list=$(find /home/xxx -type f)
listArray=($list)
for i in "${listArray[@]}"
do
onlyDate=$(echo $i | grep -P '\d{4}\-\d{2}\-\d{2}' -o)
if [[ $onlyDate < $fecha ]];then
rm $i
else
fi
done
ulimitdoes not solve your real problem.findin a variable (and an array), couldn’t you pipe it to awhile read …?