Hi all,
I have a small script that doesnt work well enough. Here is the code.
#!/bin/bash
echo $1
app=$1
procname=`ps -ef | grep -i $app | grep -v grep`
echo $procname
output
-------
./example firefox
firefox
501 247 134 0 16:13.29 ?? 67:29.49 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_131104 501 4079 2386 0 0:00.00 ttys000 0:00.01 /bin/bash ./example firefox 501 4080 4079 0 0:00.00 ttys000 0:00.00 /bin/bash ./example firefox
But when I execute the the following code on the bash shell the output is different.
app=firefox
procname=`ps -ef | grep -i $app | grep -v grep`
echo $procname
output
-------
501 247 134 0 16:41.88 ?? 68:48.90 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_131104
The outputs are different so what could be the problem?
Thanks
I have a small script that doesnt work well enough. Here is the code.
#!/bin/bash
echo $1
app=$1
procname=`ps -ef | grep -i $app | grep -v grep`
echo $procname
output
-------
./example firefox
firefox
501 247 134 0 16:13.29 ?? 67:29.49 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_131104 501 4079 2386 0 0:00.00 ttys000 0:00.01 /bin/bash ./example firefox 501 4080 4079 0 0:00.00 ttys000 0:00.00 /bin/bash ./example firefox
But when I execute the the following code on the bash shell the output is different.
app=firefox
procname=`ps -ef | grep -i $app | grep -v grep`
echo $procname
output
-------
501 247 134 0 16:41.88 ?? 68:48.90 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_131104
The outputs are different so what could be the problem?
Thanks