On Fri, 2010-03-12 at 11:07 -0500, Xingjun Chu wrote:
> Hi,
>
> I am writing a tool which has dependency on tcpdump. I am looking for a
> reliable way to figure out its path if I cannot assume its location
> always be /usr/sbin/tcpdump or always in system path.
I think that goal is pretty hard to achieve.
I think that the best you can do is this is to allow an environment
variable to provide a path, otherwise use 'which'
if [ -n "${SIPX_TCPDUMP}" ]
then
TcpDump="${SIPX_TCPDUMP}"
else
TcpDump=$(which tcpdump)
if [ $? -ne 0 ]
then
echo "Install tcpdump or, if it is installed, set SIPX_TCPDUMP to the
path to it" 1>&2
exit 1
fi
fi
# when you invoke it, use the variable...
${TcpDump} ...
_______________________________________________
sipx-dev mailing list [email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
sipXecs IP PBX -- http://www.sipfoundry.org/