Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 673566 - app-shells/bash: add color alias for watch in /etc/bash/bashrc
Summary: app-shells/bash: add color alias for watch in /etc/bash/bashrc
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2018-12-22 10:09 UTC by Vladimir Varlamov
Modified: 2024-04-15 17:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Varlamov 2018-12-22 10:09:52 UTC

> alias watch='watch --color=auto'
Comment 1 Vladimir Varlamov 2018-12-22 10:11:38 UTC
oh that is

> alias watch='watch --color'
Comment 2 kfm 2024-04-15 17:18:03 UTC
I don't think that it would be appropriate for Gentoo to do this. Consider the impact of the existing aliases that Gentoo defines. Let's take "ls --color=auto" as an example. The impact is for ls(1) to be able to format its own output depending on whether STDOUT is found to be a terminal. It knows whether STDOUT is a terminal because it uses the isatty(3) function to test the relevant file descriptor.

By contrast, the impact of the -c option on watch(1) is to determine how it treat its input, which always comes from a pipe. Keep in mind that no sensibly written program would ever try to write colour sequences to a pipe unless it is forced into doing so. Taking ls as an example again, try to run the following:

  watch -c 'ls -l --color=auto'

You will see that there is no colour at all, nor should there be. Instead, you would have to force ls to produce colour:

  watch -c 'ls -l --color=always'

Even then, there are many programs that do not provide an option for output to be forcibly colourised.

Essentially, the fact that your terminal emulator may be colour-capable is not an adequate reason to always specify -c, in and as of itself. If you go as far as to coerce a program writing to a pipe to output colour sequences then you should also then know to specify the -c option to support that particular use-case. Otherwise, there is no compelling reason for a Linux distribution to override the default behaviour of the watch utility.