pass grep --color=never

Tobias Girstmair t-passwd at girst.at
Thu Oct 6 15:44:17 UTC 2022


On Thu, Oct 06, 2022 at 04:44:58PM +0200, Knut Olav Bøhmer wrote:
>Hi,
>
>I would like to enable output without color.
>I also have on the wish list to print passfile_dir with a leading slash.

i'm assuming you need this for passing pass' output to another program.

how about using something like the code below. 'test -t' checks whether 
a file descriptor is a tty. this would keep interactive output the same, 
while automatically making pipelines work.

if [[ -t 1 ]]
then
	color=always
else
	color=never
fi

# ...

grepresults=$(... | grep --color="$color" ...)


if that's too verbose for you:

color=never
test -t 1 && color=always


More information about the Password-Store mailing list