in reply to echo $? in perl
Last time you asked this question in the CB, a long part of back and forth was spent on the difference between
print "echo $?"; # $ssh->exec("echo $?\n");
and
print 'echo $?'; # $ssh->exec('echo $?' . "\n")
You seem to have misunderstood the point that bart and I were trying to make. There are differences in Perl between strings in double quotes (") and strings in single quotes (''). To get a formal description of these differences, see perlop about "Quotes and Quotelike Operators".
Also during the last discussion, you claimed that this second approach did not work either. Maybe it does now for ou, but if it still does not, there was mention of things you could try next:
First approach - execute both commands in one ->exec statement:
$ssh->exec('your-program; echo $?');
Second approach - put all statements to execute in a shell script and execute that:
$ssh->exec('./shellscript-that-runs-your-program-and-then-outputs-doll +ar-question-mark.sh'); # where shellscript-that-runs-your-program-and-then-outputs-dollar-que +stion-mark.sh # contains the lines: # # #!/bin/sh # your-program # echo $?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: echo $? in perl
by bala_999 (Novice) on Nov 30, 2007 at 20:46 UTC |