From: Robert Klemme Date: 2009-03-06T00:28:36+09:00 Subject: Re: Getting the original file path on argument On 05.03.2009 15:35, Daniel Mantilla wrote: > Thanks guys, I think I didn't explain myself very clear. > > The script runs fine, the problem is with the command line parameter. > For example, if I try to process my_file on /home/dan : > > cd /home/dan > run_process my_file > > The script tries to find my_file on some_path/bin instead of /home/dan. > I have to provide a full path for the script to use my_file: > > run_process /home/dan/my_file > > I also tried with > > run_process ./my_file > > Same results. > > What do I have to do on my script for "run_process my_file" to run fine? > > I hope things are more clear now. Yes. The error must be in your script. As long as you do not change the current directory (e.g. via Dir.chdir) the relative path works properly. I can think of at least these two solutions: 1. remember the proper location by converting the relativ path to an absolute path using File.expand_path *before* you chdir. 2. open the file before the chdir. 3. completely get rid of the chdir. What is best depends on your script which you did not provide. Cheers robert