1#!/bin/sh 2# Ensure "ls --color" doesn't output colors for TERM=dumb 3 4# Copyright (C) 2014-2023 Free Software Foundation, Inc. 5 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. 10 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. 15 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/>. 18 19. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 20print_ver_ ls 21 22# Output time as something constant 23export TIME_STYLE="+norm" 24 25touch exe || framework_failure_ 26chmod u+x exe || framework_failure_ 27 28# output colors 29LS_COLORS='' COLORTERM='nonempty' TERM='' ls --color=always exe >> out || fail=1 30LS_COLORS='' COLORTERM='' TERM='xterm' ls --color=always exe >> out || fail=1 31 32# Don't output colors 33LS_COLORS='' COLORTERM='' TERM='dumb' ls --color=always exe >> out || fail=1 34LS_COLORS='' COLORTERM='' TERM='' ls --color=always exe >> out || fail=1 35 36cat -A out > out.display || framework_failure_ 37mv out.display out || framework_failure_ 38 39cat <<\EOF > exp || framework_failure_ 40^[[0m^[[01;32mexe^[[0m$ 41^[[0m^[[01;32mexe^[[0m$ 42exe$ 43exe$ 44EOF 45 46compare exp out || fail=1 47 48Exit $fail 49