setting $0

J

Joel VanderWerf

With the following file, t.rb,

----
#!/usr/bin/env ruby

$0 = 'My Application'
puts $0
----

the output is:

$ ruby -v t.rb
ruby 1.8.1 (2003-12-05) [i686-linux]
My Applicati

Why does it get truncated?
 
G

Gavin Sinclair

With the following file, t.rb,

----
#!/usr/bin/env ruby

$0 = 'My Application'
puts $0
----

the output is:

$ ruby -v t.rb
ruby 1.8.1 (2003-12-05) [i686-linux]
My Applicati

Why does it get truncated?


8.3 format? ;) (It's the right number of characters, just no dot.)
 
Y

Yukihiro Matsumoto

Hi,

In message "setting $0"

|With the following file, t.rb,
|
|----
|#!/usr/bin/env ruby
|
|$0 = 'My Application'
|puts $0
|----
|
|the output is:
|
|$ ruby -v t.rb
|ruby 1.8.1 (2003-12-05) [i686-linux]
|My Applicati
|
|Why does it get truncated?

It's a Linux restriction. Wishing if linux has setproctitle(3).
Interestingly, my linux box has a setproctitle man page.

matz.
 
G

Gennady

I experienced the same problem just 2 weeks ago. It happens on Solaris
as well as on Linux. I was about to post it here, when I found a work
around: you can use $0.replace instead of $0=

Gennady.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,364
Latest member
Stevanida

Latest Threads

Top