@george1421
Finally the problem lies within the next lines of the script:
choose --timeout ${menu-timeout} --default ${menu-default} selected
set menu-timeout 0
Or to be more precise, the problem is their order. ${menu-timeout} is used before it is defined and therefore, the choose command fails since it received an empty string instead of an integer.
Thanks a lot @george1421 for your support, I really appreciate it.