Hello,

I am a newbie and do not have any shell script experience. I am trying to call a script from inside a fortran call using the call system(./script).

Now this script runs ok when run from command line, but when called from the fortran call, i get errors for unzip, date etc. i.e these commands cannot be found.

Do I need to do something additional to get these commands to run ? I need to unzip a few files inside the script, hence its necessary that this works from the system call.

Thanks,
Nikhil

They don't have a full environment. Set the environment variables you need (such as PATH) in the script.

or you can give full paths in your script.
e.g.
/usr/bin/less instead of less

I'm sure you don't use less, but its an example

the best thing to do is set the environment variables in your script, like masijade said:

PATH=$PATH:/usr/bin:/usr/sbin:/sbin

I tried both suggestions but it does not seem to work. Any idea what is happening? it works when I run the script from command line.

./init.VTd.nik: ./init.VTd.nik: 18: which: not found
./init.VTd.nik: ./init.VTd.nik: 20: /usr/bin/unzip: not found
./init.VTd.nik: ./init.VTd.nik: 47: make: not found
/u0/n/nikhill/alina/./Main_new: /u0/n/nikhill/alina/./Main_new: 176: date: not found

I am calling a script called Main_new which inturn calls the script init.VTd.nik and I seem to have this problem in both the scripts.
Please suggest something.

Thanks,
Nikhil

That is not the full path to the command. I can guarantee that "." is not what you think it is. Use the full path whether setting the Path or using the full path in the command.

Hello,
this is how I am making the call from the fortran routine:

CALL system("$HOME/alina/Main_new")

Previously I was doing it this was:

CALL system("$HOME/alina/./Main_new")

The script does run but i have the same problems. Also inside the Main_new script, I call the other script as :

/${HOME}/alina/run_VT/init.VTd.nik

, again with same problems. The script does run and the cp and mv commands also work, but make, date etc do not run even with PATH or giving direct path as:

/usr/bin/date
This article has been dead for over six months. Start a new discussion instead.