i am getting output as
XYZ... ABC... This is \t\t\033[40m\033[32mUP\033[0m
instead of
XYZ... ABC... This is UP
i am trying to diplay "UP" in green colour.

below is the code:
#!/bin/bash

var=` /export/home/GT/AM/bin/xacct test -i | grep OK | wc -l`

if [[ var -eq 2 ]]; then
echo "This is \t\t\033[40m\033[32mUP\033[0m"
else
echo "This is \t\t\033[40m\033[31mDOWN\033[0m"
fi

Looks like you're on the right track! Try using 'echo -e'

In some shells, you might have to specify /bin/echo (or whatever your path is) rather than the 'echo' built into the shell.

thanks, it worked :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.