How to change / usr / bin / env?

I have scripts that use #!/usr/bin/env ruby, but I switched to using Ruby Enterprise Edition instead of the default ruby, which is included in the Ubuntu server. This way the scripts get confused when I try to run them. How to add Ruby EE path to /usr/bin/env?

+3
source share
5 answers

#!/usr/bin/env rubysimilar to a simple rubycommand line call , so the same rules apply. Basically, the individual entries in the environment variable are $PATHchecked in order, and used ruby, which is found first. So make sure that rubyfor Ruby EE it is earlier in search order than your other rubys.

Ruby EE, , ruby, , Ruby EE.

+7

Ruby EE, ( ).

 #!/usr/bin/env ruby

 #!/path/to/enterprise/edition/ruby

, ruby, - .

+5

, cron ... , Cron , PATH, ( ). , - PATH ( /etc/profile ).

, ( : cron):

su -c 'printenv PATH' userX

:/usr/local/bin:/usr/bin:/bin:/usr/games

su -l userX -c 'printenv PATH'

:/opt/ruby-enterprise-1.8.7-2010.02/bin/:/opt/ruby-enterprise-1.8.7-2010.02/bin/:/usr/local/bin:/usr/bin:/bin:/USR/

, -, PATH - , . , (REE) :/etc/login.defs, :

/etc/login.defs:103:ENV_PATH PATH =/usr/local/bin:/usr/bin:/bin:/usr/games

+2

. 1.6 Ruby EE: http://www.rubyenterpriseedition.com/documentation.html

PATH /etc/environment, bin Ruby EE. , - :

PATH = "/Opt/ -/:/USR//SBIN:/USR//:/USR/SBIN:/USR/:/SBIN:/:/USR/"

, , .bashrc .profile .

REE .

+1

, Ubuntu : http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c

Some additional steps have been taken to make it work beyond what was described in the Ruby Enterprise Edition documentation.

0
source

Source: https://habr.com/ru/post/1711592/


All Articles