Hi
Is there anyway to make the ruby commandline detects the .rb files like
python?
···
--
*Senior Information Security Engineer OSCE, GWAPT, **CEH, **OSCP, **RHCE, *
*CCNA, **MCITP-EA*
Hi
Is there anyway to make the ruby commandline detects the .rb files like
python?
--
*Senior Information Security Engineer OSCE, GWAPT, **CEH, **OSCP, **RHCE, *
*CCNA, **MCITP-EA*
No clue what this means...
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
Is there anyway to make the ruby commandline detects the .rb files like python?
What he *probably* means is that he's on Windows, and wants to just type <foo.rb> and have it execute. Which means he needs to go and Google "Windows file associations", so that he can associate files ending in .rb with the Ruby interpreter.
Note that Ruby, itself, doesn't do this -- rather, the operating system does. (In Linux/Unix, the OS follows the "shebang" method, where if an execute-enabled text file's first line begins with "#!", followed by the path to an interpreter, typing that file's name will invoke the interpreter. This won't work with Windows because it needs to be told about specific file associations.)
-Ken
On 2016-11-18 17:29, Ryan Davis wrote:
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
Is there anyway to make the ruby commandline detects the .rb files like python?
No clue what this means...
Hi,
On 2016/11/19 7:45, Ken D'Ambrosio wrote:
On 2016-11-18 17:29, Ryan Davis wrote:
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
Is there anyway to make the ruby commandline detects the .rb files
like python?No clue what this means...
What he *probably* means is that he's on Windows, and wants to just type
<foo.rb> and have it execute. Which means he needs to go and Google
"Windows file associations", so that he can associate files ending in
.rb with the Ruby interpreter.Note that Ruby, itself, doesn't do this -- rather, the operating system
does.
Ruby doesn't. And we can do it manually as Ken wrote.
RubyInstaller for Windows does through setup if a checkbox is enabled.
I've never checked it though ![]()
--
Toshi
I'm sorry for being not so clear in my question.
I'm using linux, and when we try to run a python script we type "python <tab>" the python binary can recognize all python files only . This is not the case with ruby binary
Ah! That's very interesting -- I'd never noticed that before, which is
kind of funny. Well, that's still not Ruby, per se. Tab completion is
accomplished by your shell, not the interpreter. Seems that someone
thought that would be a nice feature for Python (I admit it's kinda
nifty), and wrote up a module to do that, "argcomplete:"
argcomplete documentation [1] . Alas, it also
appears that no such thing exists for Ruby. HOWEVER. There's a way to
cheat that you appear to be unaware of. (This works for both Python and
Ruby.) There's no need for you to type the name of the interpreter at
all, if you've followed the shebang method. The first line of every Ruby
and Python script I have is (respectively):
#!/usr/bin/ruby
or
#!/usr/bin/python
Then, make sure the script is executable (chmod +x scriptname.py or
chmod +x scriptname.rb), and lo! These files are now "executables." And,
as long as the files reside in a directory that's in your path, you
could type scrip<tab>, and it would autocomplete the scriptname, itself.
Good luck!
-Ken
Hi,
Is there anyway to make the ruby commandline detects the .rb files
like python?
No clue what this means...
What he *probably* means is that he's on Windows, and wants to just type
<foo.rb> and have it execute. Which means he needs to go and Google
"Windows file associations", so that he can associate files ending in
.rb with the Ruby interpreter.
Note that Ruby, itself, doesn't do this -- rather, the operating system
does. Ruby doesn't. And we can do it manually as Ken wrote.
RubyInstaller for Windows does through setup if a checkbox is enabled.
I've never checked it though ![]()
On 2016-11-18 20:49, KING SABRI wrote:
On 19 November 2016 at 02:35, Toshihiko Ichida <dogatana@gmail.com> wrote:
On 2016/11/19 7:45, Ken D'Ambrosio wrote:
On 2016-11-18 17:29, Ryan Davis wrote:
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
--
Toshi
Unsubscribe:
<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk [2]>
--
Senior Information Security Engineer
OSCE, GWAPT, CEH, OSCP, RHCE, CCNA, MCITP-EA
Unsubscribe:
<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk [2]>
Links:
------
[1] argcomplete documentation
[2] http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk
I'm sorry for being not so clear in my question.
I'm using linux, and when we try to run a python script we type "python
<tab>" the python binary can recognize all python files only . This is not
the case with ruby binary
On 19 November 2016 at 02:35, Toshihiko Ichida <dogatana@gmail.com> wrote:
Hi,
On 2016/11/19 7:45, Ken D'Ambrosio wrote:
On 2016-11-18 17:29, Ryan Davis wrote:
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
Is there anyway to make the ruby commandline detects the .rb files
like python?No clue what this means...
What he *probably* means is that he's on Windows, and wants to just type
<foo.rb> and have it execute. Which means he needs to go and Google
"Windows file associations", so that he can associate files ending in
.rb with the Ruby interpreter.Note that Ruby, itself, doesn't do this -- rather, the operating system
does.Ruby doesn't. And we can do it manually as Ken wrote.
RubyInstaller for Windows does through setup if a checkbox is enabled.
I've never checked it though--
ToshiUnsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
*Senior Information Security Engineer OSCE, GWAPT, **CEH, **OSCP, **RHCE, *
*CCNA, **MCITP-EA*
Thanks @ken
On 19 November 2016 at 05:23, Ken D'Ambrosio <ken@jots.org> wrote:
On 2016-11-18 20:49, KING SABRI wrote:
I'm sorry for being not so clear in my question.
I'm using linux, and when we try to run a python script we type "python
<tab>" the python binary can recognize all python files only . This is not
the case with ruby binaryAh! That's very interesting -- I'd never noticed that before, which is
kind of funny. Well, that's still not Ruby, per se. Tab completion is
accomplished by your shell, not the interpreter. Seems that someone
thought that would be a nice feature for Python (I admit it's kinda nifty),
and wrote up a module to do that, "argcomplete:" https://
argcomplete.readthedocs.io/en/latest/ . Alas, it also appears that no
such thing exists for Ruby. HOWEVER. There's a way to cheat that you
appear to be unaware of. (This works for both Python and Ruby.) There's
no need for you to type the name of the interpreter at all, if you've
followed the shebang method. The first line of every Ruby and Python
script I have is (respectively):#!/usr/bin/ruby
or
#!/usr/bin/python
Then, make sure the script is executable (chmod +x scriptname.py or chmod
+x scriptname.rb), and lo! These files are now "executables." And, as
long as the files reside in a directory that's in your path, you could type
scrip<tab>, and it would autocomplete the scriptname, itself.Good luck!
-Ken
On 19 November 2016 at 02:35, Toshihiko Ichida <dogatana@gmail.com> wrote:
Hi,
On 2016/11/19 7:45, Ken D'Ambrosio wrote:
On 2016-11-18 17:29, Ryan Davis wrote:
On Nov 18, 2016, at 14:18, KING SABRI <king.sabri@gmail.com> wrote:
Is there anyway to make the ruby commandline detects the .rb files
like python?No clue what this means...
What he *probably* means is that he's on Windows, and wants to just type
<foo.rb> and have it execute. Which means he needs to go and Google
"Windows file associations", so that he can associate files ending in
.rb with the Ruby interpreter.Note that Ruby, itself, doesn't do this -- rather, the operating system
does.Ruby doesn't. And we can do it manually as Ken wrote.
RubyInstaller for Windows does through setup if a checkbox is enabled.
I've never checked it though--
ToshiUnsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>--
*Senior Information Security Engineer OSCE, GWAPT, **CEH, **OSCP, *
*RHCE, **CCNA, **MCITP-EA*Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
*Senior Information Security Engineer OSCE, GWAPT, **CEH, **OSCP, **RHCE, *
*CCNA, **MCITP-EA*