[tz] [PATCH 5/5] tzselect.ksh: add script mode option

J William Piggott elseifthen at gmx.com
Sat Feb 13 20:13:33 UTC 2016


On 02/13/2016 01:19 PM, Paul Eggert wrote:
>
>J William Piggott wrote:
>> After the calling script receives the selected time zone, then it
>> determines what to do with it and how to reply to the user. So the
>> following tail dialog (after the confirmation) makes no sense:
>>
>>   ______________________________
>>
>> Is the above information OK?
>> 1) Yes
>> 2) No
>> #? 1
>>
>> You can make this change permanent for yourself by appending the line
>>          TZ='America/New_York'; export TZ
>> to the file '.profile' in your home directory; then log out and log in again.
>>
>> Here is that TZ value again, this time on standard output so that you
>> can use the /usr/bin/tzselect command in shell scripts:
>> America/New_York
>>   ______________________________
>>
>> It needs to end after the user confirms, and the calling script takes
>> over from there. The tail dialog is distracting, confusing, and
>> unnecessary.
>
>Sorry, I'm not following the chronology, as the calling script cannot
>possibly receive the selected time zone until after tzselect outputs the
>tail dialog. So if the calling script knows that the user has confirmed,
>it can filter out any further stderr output it doesn't want; and if it
>doesn't know, it shouldn't care.
>
>Perhaps you could give a runnable example of a calling script to
>illustrate the bug?
>

#!/bin/sh

tzselect > /tmp/tz

TIMEZONE=`cat /tmp/tz`

# Do something here like
# cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime

rm -f /tmp/tz

echo "The System Time Zone is now set to $TIMEZONE"


More information about the tz mailing list