summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-13 17:24:00 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-13 17:24:00 +0200
commit9d60244eab90b29b93fe89357d5725cfecd6ddd0 (patch)
tree9763e1dcc94114c7a563c024b4dc5d7ce5417949
parent5a53c1535eff658776465045d08e0aab93e7c2df (diff)
ls_colors: don't crash on non posix strings
-rwxr-xr-xfff3
1 files changed, 2 insertions, 1 deletions
diff --git a/fff b/fff
index c5ae5b8..a4124fb 100755
--- a/fff
+++ b/fff
@@ -207,7 +207,8 @@ print_line() {
# Color files that end in a pattern as defined in LS_COLORS.
# 'BASH_REMATCH' is an array that stores each REGEX match.
- elif [[ $file_name =~ .*($ls_patterns)$ ]]; then
+ elif [[ $file_name =~ [a-zA-Z_][a-zA-Z0-9_]*$ &&
+ $file_name =~ .*($ls_patterns)$ ]]; then
# Dynamically use the variable 'file_${BASH_REMATCH[1]}'
# which stores the color from LS_COLORS.
file_ext="file_${BASH_REMATCH[1]}"