From fd49d164de4231fbf6ef113a68298f366ea6f331 Mon Sep 17 00:00:00 2001 From: i-c-u-p <96894903+i-c-u-p@users.noreply.github.com> Date: Fri, 29 Apr 2022 06:21:43 +0000 Subject: [PATCH] fix locale existence check shouldn't be using the -x option since locales always appear with the charset on the same line, making matches impossible. Also removed -F since some regex is needed to ensure only locales are matched, and added a sed to escape regex characters in $locale before its sent to grep so the user can't type something like "e." and match the "eo" locale accidentally. --- easy-arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy-arch.sh b/easy-arch.sh index fab4f71..df8ff91 100755 --- a/easy-arch.sh +++ b/easy-arch.sh @@ -203,7 +203,7 @@ locale_selector () { '/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M clear return 1;; - *) if ! grep -Fxq $locale /etc/locale.gen; then + *) if ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< $locale) " /etc/locale.gen; then incEcho "The specified locale doesn't exist or isn't supported." return 1 fi