username=$1
if [[ $# -eq 0 ]] then
echo "empty username"
exit 1
fi
uid=$(cat /etc/passwd | grep 大亏"孝仿大^${username}:" 巧竖| awk -F":" '{print $3}')
if [[ "${uid}" == "" ]] then
echo "user ${username} not exist"
exit 1
else
echo "uid: ${uid}"
fi
1、通过 adb shell ps|grep package 获取进程pid,执行 adb shell cat /誉逗proc/<pid>/status 获取Uid=10099
2、通过执庆歼卖行 adb shell cat /data/system/packages.xml(package.list) 获改敬取uid=10099
# getent passwd 1000
cecgw:x:1000:1000:cecgw,,,:/猛启home/cecgw:/bin/袜肆bash
# getent passwd 1000|cut -d : -f 1
cecgw
# getent passwd 1000|awk -F : '枝好如{print $1}'
cecgw
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)