Re: How to write IF Else condition inRunsShellScript component?
"Goldsack, Patrick" <[email protected]> Mon, 19 Feb 2007 11:51:26 -0000
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============0869000950== Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7541C.4984F9DE" This is a multi-part message in MIME format. ------_=_NextPart_001_01C7541C.4984F9DE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable There are two ways in which you might enter this command:=20 =20 firstly as a multi-line string (should work, but I haven't tried it),=20 =20 ## if [ -s /tmp/list ] then echo "Not empty" else echo "Empty" fi # =20 the second as a single line using ; as a separator for the lines and escaping " =20 "if [ -s /tmp/list ] ; then echo \"Not empty\"; else echo \"Empty\"; fi" =20 Patrick ________________________________ From: smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Ambika Awanty Sent: 19 February 2007 10:35 To: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: Shrishailappa Awanty, Ambika (STSD) Subject: [Smartfrog-developer] How to write IF Else condition inRunsShellScript component? Hi All, Can any one tell me how to write following logic in cmd field of RunShellScripts ? =20 if [ -s /tmp/list ] then echo "Not empty" else echo "Empty" fi =20 I cant write this in a file and execute that file in shell, because i want to deploy this component in another node, where this file wont be available. =20 Thanks and Regards, ambika =20 =20 ________________________________ Here's a new way to find what you're looking for - Yahoo! Answers <http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/> ------_=_NextPart_001_01C7541C.4984F9DE Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.2900.3059" name=3DGENERATOR></HEAD> <BODY> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>There are two ways in which you might enter = this command:=20 </FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>firstly as a multi-line string (should work, = but I haven't=20 tried it), </FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>##</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2> <DIV>if [ -s /tmp/list ]</DIV> <DIV>then</DIV> <DIV>echo "Not empty"</DIV> <DIV>else</DIV> <DIV>echo "Empty"</DIV> <DIV>fi</DIV></FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>#</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>the second as a single line using ; as a = separator for the=20 lines and escaping "</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D036464611-19022007> <DIV><SPAN class=3D036464611-19022007>"</SPAN>if [ -s /tmp/list ]<SPAN=20 class=3D036464611-19022007> ; </SPAN>then<SPAN = class=3D036464611-19022007>=20 </SPAN>echo <SPAN class=3D036464611-19022007>\</SPAN>"Not = empty<SPAN=20 class=3D036464611-19022007>\</SPAN>"<SPAN class=3D036464611-19022007>;=20 </SPAN>else<SPAN class=3D036464611-19022007> </SPAN>echo <SPAN=20 class=3D036464611-19022007>\</SPAN>"Empty<SPAN=20 class=3D036464611-19022007>\</SPAN>"<SPAN class=3D036464611-19022007>;=20 </SPAN>fi<SPAN class=3D036464611-19022007>"</SPAN></DIV> <DIV><SPAN class=3D036464611-19022007></SPAN> </DIV> <DIV><SPAN class=3D036464611-19022007><FONT face=3DArial color=3D#0000ff = size=3D2>Patrick</FONT></SPAN></DIV></SPAN></DIV><BR> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B>=20 smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org=20 [mailto:smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] <B>On Behalf = Of=20 </B>Ambika Awanty<BR><B>Sent:</B> 19 February 2007 10:35<BR><B>To:</B>=20 smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org<BR><B>Cc:</B> Shrishailappa = Awanty,=20 Ambika (STSD)<BR><B>Subject:</B> [Smartfrog-developer] How to write IF = Else=20 condition inRunsShellScript component?<BR></FONT><BR></DIV> <DIV></DIV><BR> <DIV>Hi All,</DIV> <DIV> Can any one tell me how to write following logic in = cmd field=20 of RunShellScripts ?</DIV> <DIV> </DIV> <DIV>if [ -s /tmp/list ]</DIV> <DIV>then</DIV> <DIV>echo "Not empty"</DIV> <DIV>else</DIV> <DIV>echo "Empty"</DIV> <DIV>fi</DIV> <DIV> </DIV> <DIV> I cant write this in a file and execute that file in = shell,=20 because i want to deploy this component in another node, where this file = wont be=20 available.</DIV> <DIV> </DIV> <DIV>Thanks and Regards,</DIV> <DIV>ambika</DIV> <DIV> </DIV> <DIV><BR> </DIV> <P> <HR SIZE=3D1> </HR>Here’s a new way to find what you're looking for - <A=20 href=3D"http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.= com/">Yahoo!=20 Answers</A> </BODY></HTML> ------_=_NextPart_001_01C7541C.4984F9DE-- --===============0869000950== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --===============0869000950== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Smartfrog-developer mailing list Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/smartfrog-developer --===============0869000950==--