As mentioned above, your "ls" is trying to be clever, and you just need to disable that -- but that's not the only source of the escape characters you're getting. The .bashrc (or maybe .profile ?) for the user account is setting the command prompt string to something "fancy" (maybe bold font?) as well.
If you can edit the .bashrc for this user account on the target machine, you can control both the "ls" behavior and the command prompt string:
alias ls='/bin/ls --color=never'
PS1='$ '
(or maybe you want the prompt string to be something particular other than '$ ' -- it's up to you). If you can't edit that .bashrc file, just issue those two command lines first thing when you connect, and then only pay attention to
the lines that are returned after that point.
if ( wantarray ) {
my @a = split "\n", $r;
# chomp( @a );
return \@a;
} else {
return $r;
}
(the chomp removes zero chars, by the way)
Well, in the case where "wantarray" returns true, of course chomp does nothing, because
split /\n/ removes all the line-feed characters.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.