Operating System - HP-UX
1753789 Members
7558 Online
108799 Solutions
New Discussion юеВ

Re: ksh script echoing path where script is located

 
SOLVED
Go to solution
John Garrott
Occasional Advisor

ksh script echoing path where script is located

Our DBA has created a ksh script that is executable by some developers. When the script is run, it displays the path to the directory that the script resides in. He would like to have this suppressed. Does anyone know of a way to do so?

John Garrott
5 REPLIES 5
Biswajit Tripathy
Honored Contributor

Re: ksh script echoing path where script is located

Assuming I understand the question correctly, we
have to see the line of script that displays the path to
be able to answer this.

- Biswajit
:-)
Stuart Abramson
Trusted Contributor

Re: ksh script echoing path where script is located

The only way that I can think of that it would echo the path to output is if he has an "echo STRING" statement in the script.

As stated above - let's see the script.
MAUCCI_2
Frequent Advisor

Re: ksh script echoing path where script is located

Must be doing echo $0?
Steve Steel
Honored Contributor
Solution

Re: ksh script echoing path where script is located

Hi


I pesume you mean that when doing a ps -ef
other users can see the full path.

Use the ln command to make a soft link from the users home dir to the script to run

> /bin/ps -ef|grep ps
root 57 0 0 Mar 11 ? 0:00 supsched
lp 1029 1 0 Mar 11 ? 0:10 /usr/sbin/lpsched
root 1281 1 0 Mar 11 ? 1:18 /opt/sharedprint/bin/spserver
steves 5302 5270 3 13:21:48 pts/0 0:00 /bin/ps -ef
>ln -s /bin/ps ps
>./ps -ef|grep ps
root 57 0 0 Mar 11 ? 0:00 supsched
lp 1029 1 0 Mar 11 ? 0:10 /usr/sbin/lpsched
root 1281 1 0 Mar 11 ? 1:18 /opt/sharedprint/bin/spserver
steves 5325 5270 4 13:22:21 pts/0 0:00 ./ps -ef



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Biswajit Tripathy
Honored Contributor

Re: ksh script echoing path where script is located

Cyrille MAUCCI wrote:
> Must be doing echo $0?

Actually that would only display the program name as
invoked by user. So, if the user does not use absolute
path while running the program, $0 would not display
absolute path. My guess is, the script is using a
command like "which", "type" or "whereis".

- Biswajit
:-)