I am trying to read the result of tzselect into a bash script in order to set the Timezone pragmatically. Code snippet should look like/usr/bin/tzselect#Read last line of tzselect and cp to /etc/localtimecp /usr/share/zoneinfo/$RESULT /etc/localtimentpdate -u 0.centos.pool.ntp.orghwclock --systohc#Following lines are just confirmation that the times are the same.datehwclock
Read the last line of tzselect
bash;timezone
tzselect prompts via stdin/stderr, with the result going to stdout. This means it's straightforward to capture in a variableNEW_TIMEZONE=$(tzselect)test -n $NEW_TIMEZONE && cp -fp /usr/share/zoneinfo/$NEW_TIMEZONE /etc/localtime