dthree/cash

Grep and ls use colors by default

Open

#26 opened on Feb 25, 2016

View on GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (7,768 stars) (253 forks)batch import
help wantednon-compliant behavior

Description

I noticed that cash's grep uses colored output by default. This doesn't seem to be a POSIX compliant default, however. On my Ubuntu system, if I type grep 'o' package.json, it's true that I'll see colored output, but that's because Ubuntu aliases grep by default.

You can see the actual default behavior of GNU grep if you type something like:

bash $ \grep 'o' package.json # Putting a backslash in front makes sure bash doesn't call an alias
bash $ alias grep # see what it's aliased to
alias grep='grep --color=auto'

I'm not sure if cash's default was by design (which wouldn't be the worst decision), or if it was just assumed this was the default.

I noticed the same thing with ls, which also doesn't use colors by default, it just so happens that it's commonly aliased to alias ls='ls --color=auto'.

Contributor guide