Force locale settings into POSIX

In CJK (Chinese, Japanese and Korean) computing,
graphic characters are traditionally classed into fullwidth.
For users who use CJK locales, the colon in the output is ':', rather than ':'.
The script cannot handle these characers, so forcing locale settings into English temporarily can solve this problem.
This commit is contained in:
wh201906 2021-08-14 03:53:33 +08:00
parent 9d9c0dd32c
commit be00c478e0
1 changed files with 8 additions and 0 deletions

View File

@ -221,6 +221,14 @@ if (( EUID != 0 )); then
exit 3 exit 3
fi fi
# set locale to POSIX(English) temporarily
# these locale settings only affect the script and its sub processes
export LANGUAGE=POSIX
export LC_ALL=POSIX
export LANG=POSIX
# check selected compression tool is supported and installed # check selected compression tool is supported and installed
if [[ -n $ziptool ]]; then if [[ -n $ziptool ]]; then
if [[ ! " ${ZIPTOOLS[@]} " =~ $ziptool ]]; then if [[ ! " ${ZIPTOOLS[@]} " =~ $ziptool ]]; then