I'm very new to perl. I have a script which telnets to a bunch of linux machines and runs some commands on them like ls
etc, the output is then written to a file. The problem is that the color codes are being returned and perl doesn't know to deal with it. So my output is filled with stuff like [01;34mALEX[0m
. Is there a way to turn off color?
Asked
Active
Viewed 843 times
1
-
The core perl module Term::ANSIColor contains the function `colorstrip` which may be used to remove color escape sequences. – Slaven Rezic Jul 10 '13 at 08:39
1 Answers
1
There is for every command. For ls for instance you can do:
ls --color=none
but what you really want to do is configure the terminal type of the connection to dumb, i.e. colors are not supported. This should automatically eliminate colors for all commands.
The way you do this depends on your setup. If terminal type negotiation is enabled on the server you should be able to specify "dumb" as the terminal type in the telnet client you use.
If not then you'll need your administrator to configure this for you.
see: here
Anyway you should have more luck asking this question in serverfault.com

Community
- 1
- 1

Eli Algranti
- 8,707
- 2
- 42
- 50