From: Jeff Schwab Date: 2009-03-05T07:33:48+09:00 Subject: Re: Getting the original file path on argument Daniel Mantilla wrote: > Hi all, I have a little ruby script that accepts a file name as a > parameter. Given the company standards, the script has to be deployed on > a specific "bin" folder. It has a cryptic name so a more "human" symlink > was created on the same folder, let's call it "run_process". I ended up > with something like this: > > some_path/bin/run_process > some_path/bin/cryptic_ruby_script.rb > > The "some_path/bin" appears on the path of the user but every time he > runs the script he has to provide the expanded file name otherwise the > script will try to find the file on some_path/bin folder. Do you mean that Ruby's current working directory is some_path/bin, even when the program is run elsewhere? > Is there a way to avoid this by just executing "run_process my_file" ? Does cryptic_ruby_script.rb have execute permission and a shebang (#!/usr/bin/env ruby)? You could try replacing the symlink with a shell script: cat > some_path/bin/run_process #!/bin/sh ruby /full/path/to/some_path/bin/cryptic_ruby_script.rb ^D chmod +x some_path/bin/run_process