blob: be8b0992ef41826a961e21a5b004bfcb63fed9cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
priority: 400
type: txt
help: Set local timezone
default: "GMT"
update: LTF="/usr/share/zoneinfo"
case "$VAR(@)" in
[Ll][Oo][Ss]*) LTF="$LTF/US/Pacific" ;;
[Dd][Ee][Nn]*) LTF="$LTF/US/Mountain" ;;
[Hh][Oo][Nn][Oo]*) LTF="$LTF/US/Hawaii" ;;
[Nn][Ee][Ww]*) LTF="$LTF/US/Eastern" ;;
[Cc][Hh][Ii][Cc]*) LTF="$LTF/US/Central" ;;
[Aa][Nn][Cc]*) LTF="$LTF/US/Alaska" ;;
[Pp][Hh][Oo]*) LTF="$LTF/US/Arizona" ;;
GMT*) LTF="$LTF/Etc/$VAR(@)" ;;
*) LTF="$LTF/$VAR(@)" ;;
esac
if [ -f "$LTF" ]; then
sudo ln -fs $LTF /etc/localtime
else
echo "Invalid timezone"
exit 1
fi
delete:expression: "sudo ln -fs /usr/share/zoneinfo/GMT /etc/localtime"
allowed: word=${COMP_WORDS[$COMP_CWORD]}
if [[ $word == */* ]]; then
marr=($(ls -d /usr/share/zoneinfo/$word*))
else
marr=($(find /usr/share/zoneinfo/ -maxdepth 1 -type d \
-name "$word*"))
fi
if (( ${#marr[@]} == 1 )); then
word=${marr[0]#/usr/share/zoneinfo/}
fi
if [ -n "$word" ] && [[ $word != */ ]]; then
marr=($(ls -d /usr/share/zoneinfo/$word*))
if (( ${#marr[@]} == 1 )) \
&& [ -d "/usr/share/zoneinfo/$word" ]; then
word=$word/
elif [[ $word == */* ]]; then
word=${word%/*}/
fi
fi
for z in $(ls -d /usr/share/zoneinfo/$word* \
2>/dev/null | egrep '^/usr/share/zoneinfo/[A-Z]'); do
zz=${z#/usr/share/zoneinfo/}
if [ -d $z ] || [[ $zz == */* ]]; then
echo \"$zz\"
fi
done
comp_help:Enter the local timezone by specifying "Region/City"
Use auto-completion to see available regions and cities.
Start with one of these regions:
Africa America Antarctica Arctic Asia Atlantic
Australia Brazil Canada Chile Europe Indian
Mexico Mideast Pacific US
|