If I do git status --short
, git lists files that are not tracked with two red question marks in front:
I'm trying to store this in a variable and print it with color later. Here's my bash script:
#!/bin/bash
status=$(git status --short)
echo -e "$status"
I thought the -e
flag would cause bash to color the output, but it isn't working:
How can I do this?
Edit: the possible duplicate is asking how escape characters, specifically ANSI color control sequences, work. I think I understand how they work. My question is how to preserve those in the script output.