我的脚本需要运行具有特定语言环境的程序才能正常工作,因此我希望它检查该语言环境是否可用。我现在已经使用了这个 hack,但我认为有更好的方法来做到这一点。
grep ^ja_JP /etc/locale.gen &>/dev/null || echo >&2 "enable any of the japanese locales first"
bash locale
bash ×1
locale ×1