How to Change Background pictures automaticaly at regular internver

I followed @Thanatermesis recommendation
while true ; do
OLD CODE LOOP - (the “for” block code)
done

So it is the following :

#!/bin/bash
source /usr/lib/elive-tools/functions

main(){
    # pre {{{
    local file

    if grep -qs "boot=live" /proc/cmdline ; then
        is_live=1
    fi

    for arg in "$@"
    do
        case "$arg" in
            --delay=*)
                time_switching_seconds="${arg##--delay=}"
                shift
                ;;
        esac
    done

    # }}}

    # minutes
    #time_switching_seconds="$(( 5 * 60 ))"
    # seconds
    if [[ -z "$time_switching_seconds" ]] ; then
        time_switching_seconds="20"
    fi

    # default wallpaper to use
    default_wallpaper="/usr/share/enlightenment/data/backgrounds/Elive Stars.edj"

    #el_debug "Starting (infinite) loop for switching between existing wallpapers"
    #while true
    #do

    # wait a bit before to start
    if ((is_live)) ; then
        sleep 40
    fi

    el_debug "Starting demo switch between wallpapers"

    # not infinite loop mode, so more friendly
    while true ; do
    for file in /usr/share/enlightenment/data/backgrounds/*edj $HOME/.e/*/backgrounds/*edj
    do
        if [[ -s "$file" ]] ; then

            el_debug "Switching to desktop wallpaper: $file"

            enlightenment_remote -desktop-bg-set "$file"

            sleep "$time_switching_seconds"
        fi
    done
    done

    if [[ -s "$default_wallpaper" ]] ; then
        el_debug "Set default wallpaper: $default_wallpaper"
        enlightenment_remote -desktop-bg-set "$default_wallpaper"
    fi

}

#
#  MAIN
#
main "$@"

# vim: set foldmethod=marker :