Hello all,
Stupid question here...I have:
ruby /Users/dc/Documents/txt/scripts/todo2log.rb $TM_FILEPATH
as a command, but it has suddenly stopped working, saying:
/bin/bash: line 1: ruby: command not found
the script:
#!/usr/local/bin/ruby
task_text = $stdin.read task_text.gsub!("\[ \] ","[X] ")
from = File.basename(ARGV[0],".txt")
File.open("/Users/dc/Documents/txt/LOGS/ completed.txt",'a'){|archive_file| archive_file.puts archive_file.puts task_text archive_file.puts " in #{from} #{`date "+%H:%M %Y%m%d %a"`}" }
ruby is to be found there (/usr/local/bin), and it worked yesterday, so I can't tell at all why this is happening...
but I know I'm missing something obvious
hints?
d
On 27. jan 2005, at 13:15, David Casal wrote:
Hello all,
Stupid question here...I have:
ruby /Users/dc/Documents/txt/scripts/todo2log.rb $TM_FILEPATH
It can't locate ruby _here_.. doesn't matter if the shebang is right later on (it's not even used). Most likely your ruby-path is setup in ~/.bash_profile, which is not sourced by TM. A solution that should fix everything path-related:
Make a file in your home-dir, say .bash_env and have it contain: source /etc/profile source ~/.bash_profile
Then set TM's BASH_ENV variable to: ~/.bash_env
That should source all relevant path stuff.
A completely different solution is of course to call the script directly: /Users/dc/Documents/txt/scripts/todo2log.rb $TM_FILEPATH ..it needs to be +x of course, for this to work.
To elaborate a little bit....
Default for TM (1.1b3) is to ship with BASH_ENV = /etc/profile. Various packages put their path additions usually in one of two places: Either in /etc/profile if the package is installed system-wide, or in ~/.bash_profile. When bash is called non-interactively (as TM does), bash will read the BASH_ENV variable and souce the script found in it. To make sure all paths are included, use the trick I wrote in the previous mail.
On 27 Jan 2005, at 12:42, Sune Foldager wrote:
Default for TM (1.1b3) is to ship with BASH_ENV = /etc/profile. Various packages put their path additions usually in one of two places: Either in /etc/profile if the package is installed system-wide, or in ~/.bash_profile. When bash is called non-interactively (as TM does), bash will read the BASH_ENV variable and souce the script found in it. To make sure all paths are included, use the trick I wrote in the previous mail.
thanks very much!
bash_env trick didn't work (will investigate why later), but calling the file directly does, so at least I'm still able to use it
d
On 27 Jan 2005, at 13:38, Allan Odgaard wrote:
On Jan 27, 2005, at 14:01, David Casal wrote:
bash_env trick didn't work
Do you have the SHLVL shell variable set to 1 (in prefs / advanced)?
Actually, all I could find in the prefs / advanced shell variables window was TM_ORGANIZATION_NAME...
I added BASH_ENV myself. Is there something wrong? Am I supposed to have more shell variables there by default?
Or, do you mean that I should add SHLVL myself to it, and then set its value to 1?
d
On Jan 27, 2005, at 15:30, David Casal wrote:
Or, do you mean that I should add SHLVL myself to it, and then set its value to 1?
You should add it. It's default in 1.1b3, but if you've ever changed the shell variables, it will not use the defaults.
I should probably have forced this entry in to the existing variables -- in case you wonder, it's a workaround for a problem (bug?) with bash (causing it to not read startup files). And I owe a lot of gratitude to Sune for debugging bash to find the problem and solution! :)
On 27 Jan 2005, at 14:34, Allan Odgaard wrote:
On Jan 27, 2005, at 15:30, David Casal wrote:
Or, do you mean that I should add SHLVL myself to it, and then set its value to 1?
You should add it. It's default in 1.1b3, but if you've ever changed the shell variables, it will not use the defaults.
Ok thanks! That definitely works!
cheers,
d
On 27. jan 2005, at 15:47, David Casal wrote:
On 27 Jan 2005, at 14:34, Allan Odgaard wrote:
On Jan 27, 2005, at 15:30, David Casal wrote:
Or, do you mean that I should add SHLVL myself to it, and then set its value to 1?
You should add it. It's default in 1.1b3, but if you've ever changed the shell variables, it will not use the defaults.
Ok thanks! That definitely works!
Ah yes, I forgot to mention the SHLVL thing. It's a workaround for a bug in bash, showing itself on Darwin kernels (at least).