-1

i am currently working in linux environment and working on generating an executable. Purpose of the application(executable) is to validate contents in the given input file.

i am required to write a script , where it will iterate through all different available time zones and run the EXE.

i am having little bit basics on writing the bash scripts , but this task seems a little difficult task for me to concoquer , any clues how can i achieve this.

  • 1
    Where exactly is the problem? Looping over the timezones, or executing your, what you call, _EXE_? Please focus on one single problem in a question. Also it would help if you would post the code you wrote so far for this problem, so that we know where you are stuck. – user1934428 Nov 09 '22 at 12:13

1 Answers1

1

This should do the trick. Remember, in variable time_zone we insert each timezone code/value.

#! /bin/bash

time_zones=( "UTC-12:00" "UTC-11:00") #array needs expansion in your case
for time_zone in "${time_zones[@]}"
do
    echo $time_zone  
    #here you can call the executable or do whatever you want
    # ./executable.sh $time_zone for example

done
mbofos01
  • 51
  • 1
  • 1
  • 10
  • Perhaps for better programming style, the variable should be called [`time_zones`](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization) – user1934428 Nov 09 '22 at 11:46
  • You have renamed `i` to `time_zone`, which is certainly a good idea, but you still are calling the array `TIME_ZONES` instead of `time_zones`. – user1934428 Nov 09 '22 at 12:11