0

I have a file that I report to daily using shell script. There are also colored texts in this report.

Normally, when the file is executed, color text is displayed, but when the result is saved to a log file and the log file is opened by Vim, the color code is displayed instead of the color.

I have no access to install any packages on the Linux.

I tried to find the answer but haven't found it yet!

  if [ -t 1 ] ; then
green=$'\x1b\x5b32m'
reset=$'\x1b\x5b0m'
  else 
green=
reset=
   fi

echo -e "\n====== ${green}Instance Status${reset} ======\n"enter code here

Output file opened in Vim:

====== Instance Status ======

0 Answers0