ruby 1.6.5, irb $0 
Author Message
 ruby 1.6.5, irb $0

narya:~> ruby -v
ruby 1.6.5 (2001-09-19) [i386-openbsd2.9]
narya:~> irb
irb(main):001:0> $0
"\000V"

vilya:~> ruby -v
ruby 1.6.5 (2001-09-19) [i686-linux]
vilya:~> irb
irb(main):001:0> $0
"\000U"

i have found lying around an older ruby whose irb $0 is as i expect

laplace:~> ruby -v
ruby 1.6.3 (2001-02-24) [sparc-solaris2.7]
laplace:~> irb
irb(main):001:0> $0
"irb"

  Pete
--
screwbean: a shrub or small tree found in the US Desert Southwest



Mon, 26 Apr 2004 02:03:19 GMT  
 ruby 1.6.5, irb $0

P> irb(main):001:0> $0
P> "\000V"

 Try this patch

pigeon% diff -u ruby.c~ ruby.c
--- ruby.c~     Wed Sep  5 08:52:17 2001

       j.pst_command = s;
       pstat(PSTAT_SETCMD, j, i, 0, 0);
     }
+    rb_progname = rb_tainted_str_new(s, i);
 #elif defined(HAVE_SETPROCTITLE)
     setproctitle("%.*s", i, s);

     }
     rb_progname = rb_tainted_str_new2(origargv[0]);
 #endif
-    rb_progname = rb_tainted_str_new(s, i);
 }

 void
pigeon%

pigeon% irb
irb(main):001:0> $0
"irb"
irb(main):002:0>
pigeon%

Guy Decoux



Mon, 26 Apr 2004 14:32:00 GMT  
 ruby 1.6.5, irb $0
Hi,

In message "[ruby-talk:24635] Re: ruby 1.6.5, irb $0"

|P> irb(main):001:0> $0
|P> "\000V"
|
| Try this patch

Oops, I forgot to backport this one to 1.6.x; thank you!

                                                        matz.



Mon, 26 Apr 2004 14:53:24 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. __FILE__ == $0 refactored in Ruby?

2. irb ruby-script w/o exiting irb?

3. Appending to $0 or $_

4. variable as search-pattern: if ($0 ~ myVar)

5. executable awk scripts and shell var $(basename $0)

6. Newbie Help required: Deleting double entries in a line ($0)

7. !x[$0]++

8. mechanism of application ($0 or the line)

9. $0 == false ??

10. program name -> perl's $0

11. $0 == __FILE__ idiom for Unix only?

12. Replacement for __FILE__ == $0

 

 
Powered by phpBB® Forum Software