I believe this to be the same issue as I am having with sshexec putting a linefeed, cr, or both. If this antuser would have put an echo on his property like so:
<echo message="XXX${return_code}XXX"/> He would have seen that there's a cr stuck in there. It does the same with output when you put it in a text file. I had it do that, then opened the text file in notepad and saw the funky character on the end of the output. The resulting property ends up being "uncomparable" because of the special character on the end. zw wrote: > > Hi > > monitor.sh is a shell script on a remote host that returns a 1 or other > non-zero number > I'm having problems trying to get property "confused" to be checked and > used > within the if-then-else condition. > But for unknown reason, it refuses to enter into the then section of > script > even though the property is matched to 1. > Am willing to hear feedback/tips from the gurus here. > Any help/tips is appreciated. > > > Output > ----------- > _check: > [sshexec] Connecting to lin2:22 > [sshexec] 1 <-------------- returned by > monitor.sh > [echo] return_code 1 > [echo] end of target > _recheck: > [echo] confused 1 > [echo] > BUILD SUCCESSFUL > Total time: 1 second > > > > > > Below is my partial script. > > > > <target name="_check"> > > <sshexec host="${host}}" > > username="${name}" > > password="${pass}" > > command=". ./.profile; > > cd ${lg_dir}; > > ./monitor.sh ; > > " > > failonerror="false" > > output="output.txt" > > outputproperty="return_code" > > timeout="0" > > trust="true"/> > > <echo message="return_code ${return_code}" /> > > <echo message="end of target" /> > > <ac:propertycopy name="confused" from="return_code"/> > > <antcall target="_recheck"/> > > </target> > > > > <target name="_recheck"> > > <echo> confused ${confused} </echo> > > <ac:if> > > <equals arg1="${confused}" arg2="1" /> > > <ac:then> > > <echo> Inside </echo> > > <ac:var name="return_code" unset="true"/> > > <ac:var name="confused" unset="true"/> > > <ac:antcallback > > antfile="main.xml" > > target="complete"> > > </ac:antcallback> > > </ac:then> > > <ac:else> > > <ac:antcallback > antfile="_start.xml" <---------- suppose to call the top > target; unknown reason why it refuses to execute even not 1 > target="_check" > return="return_code"> > </ac:antcallback --> > > </ac:else> > > </ac:if> > > </target> > > -- View this message in context: http://www.nabble.com/equals-condition-issue-tp15311286p24833938.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org