code_ex='01;32'
code_png='01;35'
c0=$(printf '\033[0m')
-c_end=$(printf '\033[m')
c_mh=$(printf '\033[%sm' $code_mh)
c_ex=$(printf '\033[%sm' $code_ex)
c_png=$(printf '\033[%sm' $code_png)
LS_COLORS="mh=$code_mh" ls -U1 --color=always file1 file2 > out || fail=1
printf "$c0${c_mh}file1$c0
${c_mh}file2$c0
-$c_end" > out_ok || framework_failure
+" > out_ok || framework_failure
compare out out_ok || fail=1
# hard links and png (hard link coloring takes precedence)
> out || fail=1
printf "$c0${c_mh}file1$c0
${c_mh}file2.png$c0
-$c_end" > out_ok || framework_failure
+" > out_ok || framework_failure
compare out out_ok || fail=1
# hard links and exe (exe coloring takes precedence)
chmod a-x file2.png || framework_failure
printf "$c0${c_ex}file1$c0
${c_ex}file2.png$c0
-$c_end" > out_ok || framework_failure
+" > out_ok || framework_failure
compare out out_ok || fail=1
# hard links and png (hard link coloring disabled => png coloring enabled)
|| fail=1
printf "file1
$c0${c_png}file2.png$c0
-$c_end" > out_ok || framework_failure
+" > out_ok || framework_failure
compare out out_ok || fail=1
# hard links and png (hard link coloring not enabled explicitly => png coloring)
|| fail=1
printf "file1
$c0${c_png}file2.png$c0
-$c_end" > out_ok || framework_failure
+" > out_ok || framework_failure
compare out out_ok || fail=1
Exit $fail
# Test for a bug that was fixed in coreutils-4.5.4.
['sl-F-color', '-F --color=always d',
- {OUT => "$e\e[01;36md$e\@\n\e[m"},
+ {OUT => "$e\e[01;36md$e\@\n"},
$slink_d, $unlink_d],
['sl-dF-color', '-dF --color=always d',
- {OUT => "$e\e[01;36md$e\@\n\e[m"},
+ {OUT => "$e\e[01;36md$e\@\n"},
$slink_d, $unlink_d],
# A listing with no output should have no color sequences at all.
# Test for a bug fixed after coreutils-6.9.
['sl-target', '--color=always d',
- {OUT => "$e\e[01;34mX$e\n\e[m"}, $target, $target2],
+ {OUT => "$e\e[01;34mX$e\n"}, $target, $target2],
# Test for another bug fixed after coreutils-6.9.
# This one bites only for a system/file system with d_type support.
['sl-dangle', '--color=always d',
- {OUT => "$e\e[40;31;01mX$e\n\e[m"},
+ {OUT => "$e\e[40;31;01mX$e\n"},
{PRE => sub {
mkdir 'd',0755 or die "d: $!\n";
symlink 'non-existent', 'd/X' or die "d/X: $!\n";
],
['sl-dangle3', '-o --color=always l',
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
- {OUT => "$e\e[40ml$e -> \e[34mnowhere$e\n\e[m"},
+ {OUT => "$e\e[40ml$e -> \e[34mnowhere$e\n"},
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
push_ls_colors('ln=target:or=40:mi=34:')
}},
],
['sl-dangle4', '-o --color=always l',
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
- {OUT => "$e\e[36ml$e -> \e[35mnowhere$e\n\e[m"},
+ {OUT => "$e\e[36ml$e -> \e[35mnowhere$e\n"},
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
push_ls_colors('ln=34:mi=35:or=36:')
}},
],
['sl-dangle5', '-o --color=always l',
{OUT_SUBST => 's/.*[0-9][0-9]:[0-9][0-9] //'},
- {OUT => "$e\e[34ml$e -> \e[35mnowhere$e\n\e[m"},
+ {OUT => "$e\e[34ml$e -> \e[35mnowhere$e\n"},
{PRE => sub {symlink 'nowhere', 'l' or die "l: $!\n";
push_ls_colors('ln=34:mi=35:')
}},
# To demonstrate it, the file in question (with executable bit set)
# must not be a command line argument.
['color-exe1', '--color=always j',
- {OUT => "$e\e[01;32md$e\n\e[m"},
+ {OUT => "$e\e[01;32md$e\n"},
$exe_in_subdir, $remove_j],
# From Stéphane Chazelas.
. "\e[30;43msetgid$e\n"
. "\e[37;41msetuid$e\n"
. "\e[37;44msticky$e\n"
- . "\e[m"
},
{POST => sub {