in reply to Color in windows command prompt
use if $^O eq "WINMS32", Term::ANSIColor qw(:constants); produces: syntax error at C:\temp\gethost3.pl line 4, near "Term::ANSIColor qw(: +constants)" Execution of C:\temp\gethost3.pl aborted due to compilation errors. Windows #!/usr/bin/perl use Win32::Console::ANSI; use Term::ANSIColor qw(:constants); $SUCCESS=GREEN; $NORMAL=RESET; $RESULT="THIS IS THE RESULT LINE"; $line=sprintf("%s%s%s\n",$SUCCESS.$RESULT.$NORMAL); print $line; Unix !/usr/bin/perl $FAILURE=`echo -en "\\033[1;31m"`; $SUCCESS=`echo -en "\\033[1;32m"`; $NORMAL=`echo -en "\\033[0;39m"`; $RESULT="Test Line Test Line Test Line Test Line Test Line Test Line T +est Line Test Line "; $line=sprintf("%s%s%s\n",$SUCCESS.$RESULT.$NORMAL); print $line; $line=sprintf("%s%s%s\n",$FAILURE.$RESULT.$NORMAL); print $line;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Color in windows command prompt
by g_speran (Scribe) on Jan 16, 2018 at 22:50 UTC | |
by syphilis (Archbishop) on Jan 16, 2018 at 23:36 UTC |