dd: don’t trust st_size on /proc/files
[coreutils.git] / tests / ls / color-term.sh
blob459ce5a08732d4d180f1f92a1dcbaa2d03b97f7c
1 #!/bin/sh
2 # Ensure "ls --color" doesn't output colors for TERM=dumb
4 # Copyright (C) 2014-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ ls
22 # Output time as something constant
23 export TIME_STYLE="+norm"
25 touch exe || framework_failure_
26 chmod u+x exe || framework_failure_
28 # output colors
29 LS_COLORS='' COLORTERM='nonempty' TERM='' ls --color=always exe >> out || fail=1
30 LS_COLORS='' COLORTERM='' TERM='xterm' ls --color=always exe >> out || fail=1
32 # Don't output colors
33 LS_COLORS='' COLORTERM='' TERM='dumb' ls --color=always exe >> out || fail=1
34 LS_COLORS='' COLORTERM='' TERM='' ls --color=always exe >> out || fail=1
36 cat -A out > out.display || framework_failure_
37 mv out.display out || framework_failure_
39 cat <<\EOF > exp || framework_failure_
40 ^[[0m^[[01;32mexe^[[0m$
41 ^[[0m^[[01;32mexe^[[0m$
42 exe$
43 exe$
44 EOF
46 compare exp out || fail=1
48 Exit $fail