Hi I am having problems with the following script ============================================================ #! /usr/bin/rc res=`{telnet phoenix.earthlight.co.nz 4647 >[2] /dev/null} echo `{date} ' ' $res(10) >> /home/joe/bin/modemcheck.log if ( ~ $res 1 2 3 ) {killppp 900 } ============================================================ This script works fine when called from the command line but when run from cron nothing is returned in the variable $res. Anyone have any suggestions as to what is going wrong here. Joe. ps. I am I still on this list as things seem to have been very quite recently. -- ======================================================================= in real life: Joseph Skinner |There's no such thing as a wizard email: joe@earthlight.co.nz |who minds his own business Analyst/Programmer ECL | - Berengis the Black http: www.earthlight.co.nz/users/joe| Court Mage to the Earls Caeline ========================================================================
> I am having problems with the following script > > ============================================================ > #! /usr/bin/rc > > res=`{telnet phoenix.earthlight.co.nz 4647 >[2] /dev/null} > echo `{date} ' ' $res(10) >> /home/joe/bin/modemcheck.log > if ( ~ $res 1 2 3 ) {killppp 900 } > ============================================================ > > This script works fine when called from the command line but when run > from cron nothing is returned in the variable $res. > > Anyone have any suggestions as to what is going wrong here. No suggestions yet, but could you answer the following. What happens if you use "echo hello" insted of "telnet ..."? What happens if you do the same thing using "sh"? > ps. I am I still on this list as things seem to have been very quite > recently. Lists are full of 1) Bug reports or 2) Pleas for new features or 3) "How do I do this?" My guess is that: There is not many bugs left in rc. The users of rc thinks there should not be more features (I do. I would actually like to get rid of else and reinstate ifnot). The users of rc are competent enough to handle the things they want to do. Best Wishes, Bengt =============================================================== Everything aforementioned should be regarded as totally private opinions, and nothing else. bengt@softwell.se ``His great strength is that he is uncompromising. It would make him physically ill to think of programming in C++.''
> This script works fine when called from the command line but when run
> from cron nothing is returned in the variable $res.
Is $PATH set correctly when run from cron? Usually, cron only provides
a bare minimum path to the programs it spawns.
--p
> The users of rc thinks there should not be more features (I do. I would actually
> like to get rid of else and reinstate ifnot).
I had and interesting discussion with Byron about this when he
first released rc. His response was somewhat less than favourable.
> I had and interesting discussion with Byron about this when he
> first released rc. His response was somewhat less than favourable.
Well, I am not sure I see any change since then that would make my
opinion of "if not" more favorable. First of all, it's just the
wrong way to write a conditional. It reminds me more of assembly
language programming than any high level language I know! If I
remember correctly Duff's paper also describes it as a bug in the
language spec. Secondly, rc (my reimplementation) has been around
now for 7 years and to break the syntax over a quibble like this
seems to me contrary to what we've worked for to this point: a
stable, reliable shell. Thirdly, I am not aware of what the state
of plan 9 is these days, but I assume from a practical point of view
it's at best a curiosity, and no one has ever written to me about
the need for interoperating unix and plan 9 rc scripts.
So I just don't see any reason to make this change.
Byron.