sed -re 's/(.*)_.*/\1/' -e 's/(.*)\-[0-9]+$/\1/' <<< 'aaa_bbb_ccc_800x600.jpg'
sed -re 's/(.*)_.*/\1/' -e 's/(.*)\-[0-9]+$/\1/' <<< 'vvv_xxx-yyy_zzz_xxx-1_800x600.webp'
sed -re 's/(.*)_.*/\1/' -e 's/(.*)\-[0-9]+$/\1/' <<< 'pict3_480x300.jpg'
sed -re 's/(.*)_.*/\1/' -e 's/(.*)\-[0-9]+$/\1/' <<< '3_480x300.jpg'
find /var/www -type f -regex ".*/modified/[^/]+\.jpg" | while read -r path; do name="${path##*/}"; [ ! -f "${path%modified/*}${name%%_*}_parent.jpg" ] && rm -f "$path"; done
read -p "Number of ports: "
for (( i = 0; i < $REPLY; i++ ))
do
read -p "Input port: " ports[i]
done
echo ${ports[@]}