Subject: | Escape characters returned in results from SSH Expect... |
Date: | Mon, 19 Nov 2007 02:10:27 -0800 (PST) |
To: | bug-Net-SSH-Expect [...] rt.cpan.org |
From: | Kevin Wriston <klw71 [...] yahoo.com> |
Results returned from the SSH Expect include escaped character
sequences. I've enclosed some code and output to show you how this
looks...
Thanks,
Kevin
--
$cmd = $ssh->exec("ls $remotedir");
#print "cmd=$cmd\n";
$chr = chr(13);
my @lines = split(/$chr/, $cmd);
#print "lines = " . @lines . ", @lines";
## get rid of the original command on the first line and the prompt
on the last line...
$lines[0] = "";
$lines[@lines-1] = "";
foreach $line (@lines) {
$chr = chr(10);
$line = join("",split(/$chr/,$line));
#print "line = $line\n";
##klwr - this won't work for files with spaces...
my @files = split(/ /, $line);
foreach $filename (@files) {
if ($filename ne "") {
my @chars = split(//,$filename);
foreach $char (@chars) {
print "$char (" . ord($char) . ")\n";
}
print "file = $filename\n";
push(@results, "$filename");
}
}
}
--
(27)
[ (91)
0 (48)
1 (49)
; (59)
3 (51)
2 (50)
m (109)
p (112)
a (97)
s (115)
s (115)
i (105)
v (118)
e (101)
z (122)
e (101)
k (107)
a (97)
y (121)
i (105)
. (46)
p (112)
l (108)
(27)
[ (91)
0 (48)
0 (48)
m (109)
file = passivezekayi.pl