R
R
raury2020-03-09 17:46:37
linux
raury, 2020-03-09 17:46:37

What is the command to run a ruby ​​script on linux regardless of location?

Let's say test.rb is in one folder now, and tomorrow in another, but the command to run should be the same. Is this possible?
If possible, then tell me on windows, thanks.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vladimir Korotenko, 2020-03-09
@firedragon

Look at the path variable, everything in it starts

P
pfg21, 2020-03-09
@pfg21

the file lies in the same place where it is executed.
for shoving between other places, a copy is used in the form of a hard or soft link.

S
Sergey Blokhin, 2020-03-09
@TITnet

You have:

  1. two different files
  2. with one name
  3. in different folders

/foo/main.rb
/bar/main.rb

Where should your subsystem get the file to run from?
Describe your task/problem that you want to solve in more detail.

G
Germanjon, 2020-03-10
@Germanjon

Give more details:
- Are the folder names with the file location random or is there some kind of dependency?
- Are there other similar files (in principle, you can dodge and find the required file by name and checksum / hash).
- And most importantly, why such perversions?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question