FAQ
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:

tadipah@nhpljt007:~/THI/scripts> file temp.txt
temp.txt: ASCII text, with CRLF line terminators

tadipah@nhpljt007:~/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

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 6 | next ›
Discussion Overview
groupbeginners @
categoriesperl
postedAug 27, '08 at 6:32p
activeAug 27, '08 at 8:40p
posts6
users5
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase