Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: One liner to test existance of a file

by kamal (Sexton)
on Jul 15, 2010 at 01:02 UTC ( #849669=note: print w/ replies, xml ) Need Help??


in reply to Re: One liner to test existance of a file
in thread One liner to test existance of a file

if i use

q{if [ -e /.firstboot ] ; then echo 1 ; else echo 0 ; fi}
i get:

0 root@baseline-dc1:~#

The required output should be: 0 with NO new line, or carriage return, or space. somehow (i think) due to Net::SSH::Expect the prompt of the remote system is being appended to $stat hence i need to remove it


Comment on Re^2: One liner to test existance of a file
Download Code
Re^3: One liner to test existance of a file
by ikegami (Pope) on Jul 15, 2010 at 02:55 UTC
    That command does not output that at all. -n prevents echo from outputting a newline. As for the prompt, it comes from the shell. Don't run a shell interactively, hide its prompt, waitfor it, or exec a shell to execute the command, causing the connection to drop after the output has been obtained.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://849669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (14)
As of 2015-07-03 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls