LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell script is defined in someother directory, how it is being invoked with path? (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-is-defined-in-someother-directory-how-it-is-being-invoked-with-path-883567/)

vaibhavs17 05-30-2011 01:39 PM

shell script is defined in someother directory, how it is being invoked with path?
 
extract.ksh use this scripts topic_file_publish.sh but extract.ksh resides in
/data/apps/pnbos/scripts

but topic_file_publish.sh in below directory

/data/apps/pnbgstk/publication > ls topic_file_publish.sh
topic_file_publish.sh
fraespappp8:/data/apps > type topic_file_publish.sh
topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)

how it is done?

since topic_file_publish.sh is being directly referenced in the code with absolute path.

Thanks,
Vaibhav

tommyttt 05-30-2011 09:47 PM

Quote:

Originally Posted by vaibhavs17 (Post 4371258)
extract.ksh use this scripts topic_file_publish.sh but extract.ksh resides in
/data/apps/pnbos/scripts

but topic_file_publish.sh in below directory

/data/apps/pnbgstk/publication > ls topic_file_publish.sh
topic_file_publish.sh
fraespappp8:/data/apps > type topic_file_publish.sh
topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)

how it is done?

since topic_file_publish.sh is being directly referenced in the code with absolute path.

Thanks,
Vaibhav

An absolute path explicitly states the FULL path to the file (i.e. - /home/user/somedir/somescript). Is that what you mean?

Also, are you mixing shells (.sh is usually bash where .ksh is usually korn shell)

Tom

AnanthaP 05-30-2011 10:24 PM

I draw your attention to:

Quote:

fraespappp8:/data/apps > type topic_file_publish.sh
topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)
the `type` command clearly says that is hashed and seems to point to /data/apps/pnbgstk/publication/topic_file_publish.sh which is what you expect.

Some general points.
(1) which command will tell form which element in the path, the program is found.
(2) It all depends on the contents of the specific scrips which you haven't shared.


All times are GMT -5. The time now is 05:40 PM.