Re: while if string compare

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 01/05/05


Date: 4 Jan 2005 23:31:05 GMT

On Tue, 04 Jan 2005 at 23:16 GMT, Billy Patton wrote:
> On Tue, 4 Jan 2005, Chris F.A. Johnson wrote:
>
>> On Tue, 04 Jan 2005 at 22:28 GMT, Billy Patton wrote:
>>> I'm trying to loop sleeping 2 minutes each time
>>> when bjobs is empty str will be empty
>>> The following gwets me a
>>>> tcsh -x ./x
>>> while ( 1 )
>>> set str = `/usr/local/lsf/bin/bjobs`
>>> /usr/local/lsf/bin/bjobs
>>> if ( JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME 336642
>>> bpatton RUN normal holster07.d lag13.dal.d sleep 400 Jan 04 16:22 == ) then
>>> if: Expression Syntax.
>>>
>>>
>>> while ( 1 )
>>> sleep 120
>>> set str = `/usr/local/lsf/bin/bjobs`;
>>> if ( $str == '' ) then
>>
>> if ( "$str" == '' ) then
>>
>>> echo "no more jobs"
>>> break;
>>> endif
>>> end
>
> Problem now is that he string gets too long.
> It can be K lines long.
>
> What can I use instead of "$str" == '' ?
>
> I get "Word too long." error and it stops?

    Use a real scripting shell. :)

#!/bin/sh
while :
do
  sleep 120
  str=`/usr/local/lsf/bin/bjobs`
  if [ -x "$str" ]
  then
      echo "no more jobs"
      break
  fi
done

-- 
    Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: while if string compare
    ... On Tue, 4 Jan 2005, Chris F.A. Johnson wrote: ... >> Problem now is that he string gets too long. ... > and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)
  • Re: Echoing value of variable when value contains "$"
    ... On 2004-10-08, Vlad Grama wrote: ... > value of variable a without further interpreting the resulting string. ... My code in this post is copyright 2004, Chris F.A. Johnson ... and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)
  • Re: Question
    ... On Fri, 29 Aug 2003 at 00:25 GMT, Michael Wang wrote: ... > If you do not do what I suggested, I don't think your string ... My code in this post is copyright 2003, Chris F.A. Johnson ... and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)
  • Re: looking for function
    ... Billy Patton wrote: ... > return the output into a string. ... There is no such function in Standard C. ... library function, so you could ask on a newsgroup for your system, if ...
    (comp.lang.c)
  • Re: looking for function
    ... Billy Patton wrote: ... > return the output into a string. ... There is no such function in Standard C. ... library function, so you could ask on a newsgroup for your system, if ...
    (alt.comp.lang.learn.c-cpp)