Strip quotes in locale output, e.g. macOS

This commit is contained in:
Michael Boelen 2020-06-23 10:57:45 +02:00
parent 8596156ca1
commit 44fb7efd64
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04

2
lynis
View File

@ -216,7 +216,7 @@
# Extract the short notation of the language (first two characters). # Extract the short notation of the language (first two characters).
if [ -x "$(command -v locale 2> /dev/null)" ]; then if [ -x "$(command -v locale 2> /dev/null)" ]; then
LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$") LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | tr -d '"' | egrep "^[a-z]{2}$")
# Try locale command if shell variable had no value # Try locale command if shell variable had no value
if [ -z "${DISPLAY_LANG}" ]; then if [ -z "${DISPLAY_LANG}" ]; then
DISPLAY_LANG=$(locale | egrep "^LANG=" | cut -d= -f2) DISPLAY_LANG=$(locale | egrep "^LANG=" | cut -d= -f2)