[#4567] Re: What's the biggest Ruby development? — Aleksi Niemel<aleksi.niemela@...>

Dave said:

18 messages 2000/08/23
[#4568] Q's on Marshal — Robert Feldt <feldt@...> 2000/08/23

[#4580] RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/25

[#4584] Re: RubyUnit testcase run for different init params? — Dave Thomas <Dave@...> 2000/08/25

Robert Feldt <feldt@ce.chalmers.se> writes:

[#4623] Re: RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/28

On Sat, 26 Aug 2000, Dave Thomas wrote:

[#4652] Andy and Dave's European Tour 2000 — Dave Thomas <Dave@...>

24 messages 2000/08/30
[#4653] Re: Andy and Dave's European Tour 2000 — matz@... (Yukihiro Matsumoto) 2000/08/30

Hi,

[#4657] Ruby tutorials for newbie — Kevin Liang <kevin@...> 2000/08/30

Hi,

[ruby-talk:04487] Re: RubyUnit. Warnings to be expected?

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-08-17 11:26:30 UTC
List: ruby-talk #4487
On 17 Aug 2000, Dave Thomas wrote:

> Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
> 
> 
> > Can ruby detect the -w on the #! line?
> 
> Not just detect, but honor. Try this one:
> 
> 
> t.rb:  #!/usr/bin/perl
>        print $^O, "\n";
> 
> 
> Then execute
> 
>        ruby t.rb
> 
> Talk about a personality change....

:-)  That is nice.
> 
> 
> >  That seems an unusual arrangement!
> 
> Actually, it's pretty standard. Perl does it, as does the shell. If

/bin/sh doesn't do this -- Hey! it never used to, but it does on
Solaris.  I'm not sure about bash, and I never thought
about doing it with anything other than /bin/csh.

> you think about it, that's how Ruby gets run in the first place from
> an executable script: something (either the shell or the OS) starts
> reading the script, finds the #! line and says "oops, not for me, I'll 
> pass this on to Ruby".

I thought this was only in /bin/csh and things that (multiply) inherited
from it (tcsh and the like).

Actually it is more subtle than that:

chmod u+x ./t.rb
brains hgs 37 %> !.
./t.rb
solaris
brains hgs 38 %> ruby !$
ruby ./t.rb
solaris
brains hgs 39 %> ksh
$ ./t.rb
solaris
$ exit
brains hgs 40 %> sh
$ ./t.rb
solaris
$ exit
brains hgs 41 %> sh t.rb
t.rb: print: not found
t.rb: O,: not found
brains hgs 42 %> ksh t.rb
$^O, 

brains hgs 43 %> python t.rb 
  File "t.rb", line 2
    print $^O, "\n";
          ^
SyntaxError: invalid syntax
brains hgs 44 %> csh t.rb
Variable syntax
brains hgs 45 %> 

from within a csh session.   Interesting.
> 
> 
> Regards
> 
> 
> 
> Dave
> 
> 
	Hugh
	hgs@dmu.ac.uk



In This Thread