我的脚本需要以特定的语言环境运行,才能正常工作。因此,我想让它检查这种语言环境是否可用。目前我使用了这个技巧,但我认为还有更好的方法来做到这一点。
grep ^ja_JP /etc/locale.gen &>/dev/null || echo >&2 "enable any of the japanese locales first"