system OS: ubuntu, redhat
shell: /bin/sh
i noticed that if im running a script and i go to a separate terminal and type:
ps -efauxx | egrep "<the-script-name>"
i see that the content of all the variables in the script are all visible. How can i avoid/prevent this?
the scripts in question are many and i cant paste them all in this thread. but, suffice it to say, most of the scripts are run through a pipe...i.e.
cat <script> | sh
any recommendations?
apmcd47
2
What do you think
ps -efauxx
is doing? Explain every option. Explain why you need them all. Are you mixing UCB options (e.g. ps aux
) with Posix options (e.g. ps -ef
)?
Are you seriously running your shell-scripts by the above method? Or are you doing something more like this?
sh script1 | sh script2
Andrew
im doing something more like:
script1.sh | script2.sh
bakunin
4
~ Sigh ~
Could you, please, show us WHAT YOU DO, not "something more like...." what you do?
For questions about something more like whatever you do you will perhaps get something more like a solution instead of a real solution itself.
I hope this helps.
bakunin
apmcd47
5
In that case you could consider using pgrep
ps -p $(pgrep -d, script-name) -F
or (I've just discovered this myself!) ps -C name
ps -F -C script-name
You can use the -o
switch to define the output format of ps
.
Andrew
PS I think your original problem with the environment variables was to do with mixing Posix and UCB command options. Your
ps -efauxx
was being interpreted as the UCB-compatible command
ps auxe
You cannot mix options with a -
with options without a -