954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help in shell script.

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

Gyani.gtst
Newbie Poster
3 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

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.

Gromit
Posting Whiz in Training
212 posts since Sep 2008
Reputation Points: 47
Solved Threads: 31
 

thanks, it worked :D

Gyani.gtst
Newbie Poster
3 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You