fix extraction of LS_COLORS

Strip surrounding quotes if present.

Fixes #3630
This commit is contained in:
Kurtis Rader 2016-12-07 13:55:31 -08:00
parent d0077d0910
commit b48b2ddfb2

View file

@ -23,6 +23,10 @@ if command ls --version >/dev/null ^/dev/null
# Here we rely on the legacy behavior of `dircolors -c` producing output suitable for
# csh in order to extract just the data we're interested in.
set -gx LS_COLORS (dircolors -c $colorfile | string split ' ')[3]
# The value should always be quoted but be conservative and check first.
if string match -qr '^([\'"]).*\1$' -- $LS_COLORS
set LS_COLORS (string match -r '^.(.*).$' $LS_COLORS)[2]
end
end
end
else if command ls -G / >/dev/null ^/dev/null