g_speran has asked for the wisdom of the Perl Monks concerning the following question:
I have the script below that works fine on unix platforms, however, I am struggling to get this to work on the windows platform. I am trying to keep the same format using sprintf. I used "Win32::Console::ANSI;" and "Term::ANSIColor qw(:constants)" in the sprintf format below, and failed. Any Suggestions?
#!/usr/bin/perl $FAILURE=`echo -en "\\033[1;31m"`; $SUCCESS=`echo -en "\\033[1;32m"`; $NORMAL=`echo -en "\\033[0;39m"`; $RESULT="JUST A SIMPLE LINE"; $line=sprintf("%s%s%s %s\n",$SUCCESS,$RESULT,$NORMAL); print "$line\n"; $line=sprintf("%s%s%s %s\n",$FAILURE,$RESULT,$NORMAL); print "$line\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Color in windows command prompt
by Discipulus (Canon) on Jan 16, 2018 at 22:36 UTC | |
|
Re: Color in windows command prompt
by g_speran (Scribe) on Jan 16, 2018 at 22:41 UTC | |
by g_speran (Scribe) on Jan 16, 2018 at 22:50 UTC | |
by syphilis (Archbishop) on Jan 16, 2018 at 23:36 UTC |