Spawning a shell script

Hi there,

I have a shell script which I need to run it from two different places on the same server, are there any specific rules I need to apply? What is the best practice to achieve this task.

Regards

It depends on what script does ;
What resources (files,databases .... etc ) the script access

Hi bhargav,

Let's assume a very simple unix script that runs few unix commands, lik edf -k, ps -ef, etc...

Regards

If you ran ps -ef, it would not matter where you were (present working directory) - it still gives the same output.

If you are looking for where you should put the script so it's in your PATH, then check your PATH with
$ echo $PATH

Normally, there is a certain directory folks use (according to how they were taught usually) - /usr/local or /opt/local may be set up in your environment. Putting your script into /usr/local/bin or /usr/local/scripts may suffice.

Absolute and relative path for directoroes anf files:

a).Be sure to use absolute PATHs for directories/files instead of relative PATHS in the scirpt.

b).Do n't use absolute PATH in case you are saving some data into the files or creating temp files and making use of them in the flow of the script.

For temp savings it should be good idea to use relative directories
because u want to run the script from 2 different places at the same time.

c).And as RTM said... u should have the same env (PATH .. etc )settings in both the places before running the script to get the same results.

The idea is to simulate unix operation, if many users type the command ls, many output will be displayed for all the users.

I want to do something similar.

Regards