Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Mar 2010
    Location
    New Jersey USA
    Posts
    83
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Shell or Perl script increment by 1 in a loop

    I'm trying to get the below code into a loop where it runs over and over again while increasing the ./rundate????????.sh by 1 day

    For example: First it runs "rundate20170101.sh" second it runs "rundate20170102.sh" .. .. .. fifteenth time runs "rundate20170115.sh"

    I'm trying to get this script to run from the start to finish. then loop back to the start but change the .rundate2070101.sh to rundate20170102.sh but the other questions still asked after the first loop.

    any help would be greatly appreciated.

    Thanks!
    Code:
    yn() { echo -n "$1: "
           while read  -sN1 x ; do
               x=${x,}
               case $x in [yn]) break ;; *) : ;; esac
           done
           echo $x
           [ $x = y ] ; }
    
    yn "Do you want to install the new update? [Y/n]" || exit
    ./install.sh
    echo "Pick a rundate file: "
    select x in ./rundate????????.sh ; do $x ; break ; done
    yn "Would you like to run the patch? [Y/n]" || exit
    ./patch.sh
    Last edited by connollyc4; 06-13-2017 at 04:18 AM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •