0
我想用這個shell腳本從ndk得到詳細的錯誤,如這裏提到的 [link]。但我收到一些錯誤,我不知道shell腳本,任何人都可以在這裏幫助我?shell腳本中的錯誤從logcat獲取Android的源信息
CODE
if [ $# -lt 1 ]
then
echo usage: $0 app
exit 0
fi
APP=$1
LOG_FILE=$2
if [ ! -n "${ANDROID_NDK}" ]
then
ANDROID_NDK=`dirname $0`
echo ANDROID_NDK is not set using ${ANDROID_NDK}
fi
ADDR2LINE=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-eabi-addr2line
if [ ! -s $LOG_FILE ]
then
echo File $LOG_FILE does not exist or empty.
exit 0
fi
while read LINE
do
echo $LINE
if [[ $LINE =~ ^.+\#[0-9]{2}\ +pc\ +([0-9A-Fa-f]{8})\ +(.+\.so).?$ ]]
then
ADDR=${BASH_REMATCH[1]}
SO=`basename ${BASH_REMATCH[2]}`
SRC=`${ADDR2LINE} -C -f -e ${ANDROID_NDK}/out/apps/${APP}/armeabi/$
{SO} ${ADDR} 2>/dev/null`
echo ${SRC}
OUTPUT
./stack.sh: line 42: conditional binary operator expected
./stack.sh: line 42: syntax error near `=~'
./stack.sh: line 42: ` if [[ $LINE =~ ^.+#[0-9]{2}\ +pc\ +([0-9A-Fa-f]{8})\ +(.+\.so).?$ ]] '