dthree/cash

Grep and ls use colors by default

Open

#26 建立於 2016年2月25日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)JavaScript (7,768 star) (253 fork)batch import
help wantednon-compliant behavior

描述

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'.

貢獻者指南

Grep and ls use colors by default · dthree/cash#26 | Good First Issue