I have the following command that redirects output from the script to 
temp.txt.

system "ssh -x -t $_ \"sudo /home/tadipah/test.sh\" > temp.txt ";

If I open the file temp.txt, I can see one word "jboss"; I tried to print 
it using the code below:

open TESTFILE, "temp.txt";
@srv=<TESTFILE>; chomp(@srv);
    print "@srv \n";

All i get is " boss" . It is replacing the first charecter with a space 
for some reason. Then I further tried creating my own text file names 
temp.txt with jboss as its content. To my surprise, it printed "jboss" 
this time.

So, I did  a further research on the type of file the script is 
automatically redirecting to as compared to the file I have created. Here 
is the output:

[EMAIL PROTECTED]:~/THI/scripts> file temp.txt
temp.txt: ASCII text, with CRLF line terminators

[EMAIL PROTECTED]:~/THI/scripts> file temp.txt
temp.txt: ASCII text

So clearly, the file format made the differrence. Can someone please help 
me how to combat this situation. I want automatic redirect of my shell 
script to work normally.

Thanks,
Hary

Reply via email to