in reply to One liner to test existance of a file

Your code is not valid Perl code. Your snippet does not even run in your shell. See perlrun.

Also, double quotes will be interpolated by Perl first. So your shell snippet won't look like you want. Do the following to see what goes wrong:

my $snippet = "perl -e /.firstboot | echo $?"; print "Running <$snippet>\n"; my $stat = $ssh->exec("perl -e /.firstboot | echo $?");

Also, why do you want to launch Perl on the remote end, when the unix shells have test to test for the existence of a file?

Also see Filesys::Virtual::SSH

Replies are listed 'Best First'.
Re^2: One liner to test existance of a file
by kamal (Sexton) on Jul 14, 2010 at 20:22 UTC
    This part of the code is inside an infinite loop to test if the remote linux host has booted or not. I am using Net::SSH::Expect hence you see $ssh->exec(); i am retrofitting this into an existing system. which has stopped working. so there are things like running a command on the remote system to populate $stat that i have to live with. I will try your suggestions, Thank you so much. I really appreciate it.