sh 并與常規(guī) UNIX 兼容,這已經(jīng)是困難重重了,而同時它也經(jīng)過了大量的學習經(jīng)驗。創(chuàng)建運行在所有這些平臺上的單個腳本事實上是非常棘手的,主要因為我根本無權訪問這些操作系統(tǒng)中的大多數(shù)系統(tǒng)!要感謝的是,全球范圍內(nèi)的
psopts="FAIL"
ps uxw >/dev/null 2>&1
if [ $? -eq 0 ]
then
psopts="uxw"
else
ps -u `whoami` -f >/dev/null 2>&1
if [ $? -eq 0 ]
then
psopts="-u `whoami` -f"
fi
fi
if [ "$psopts" = "FAIL" ]
then
echo $0: unable to use \"ps\" to scan for ssh-agent processes.
Report KeyChain version and echo system configuration to drobbins@gentoo.org.
exit 1
fi
mypids=`ps $psopts 2>/dev/null | grep "sh-agent" | awk '{print $2}'` > /dev/null 2>&1