How to get rid of control chars when using Korn sh (wodSSH / wodSSH.NET)
Hello.
I'm having trouble using wodSSH with the ksh shell (Korn shell). It is set on our customer's machine and it's hard or impossible to change shell settings there.
When I send some long command (in the example below it is a sequence of echo ) I get the output like this:
echo 123;echo 123;echo 123;echo 123;echo 123;echo 123;ech<#13>cho 123;echo 123;echo 123;echo 123;ech <<#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8><#8>o 123 <#13><#13><#10><#13><#10>123<#13><#10>123<#13><#10>123<#13><#10>123<#13><#10>123<#13><#10>123<#13><#10>123<#13><#10>$
I've replaced all ASCII control chars with <#N> .
When I enter long command in Putty for example I see that the shell is wrapping lines so that only the last several chars are visible and puts some spaces and < in the end of the line. Seems that when I use wodSSH I get the same sequence of characters. The terminal is adding and
characters to format the output properly. I'm trying to get rid of these control chars while do not corrupt the output. What I have tried:
1. Setting SSH object properties before connecting (some of them or all together):
ssh_.StripANSI = true;
ssh_.Columns = 1000;
ssh_.TerminalType = tty ; // (or dumb )
- nothing changed. I still get control chars.
2. Setting environment variable COLUMNS=1000 just after connecting. It helps on our local linux machine, but doesn't help on the customer's.
3. Trying to find out the logic and removing the garbage manually. I could do this for our local linux machine, but couldn't for the customer's.
Is there a way I can get the clear output?
Complete thread:
- How to get rid of control chars when using Korn sh - Virgoss, 2007-10-15, 09:41
- Re: How to get rid of control chars when using Kor - woddrazen, 2007-10-15, 10:49