简体   繁体   中英

adb commands in bash script(copying sqlite from android to mac)

I need to do same commands by bash script automatically. I'm on Mac and I'm getting tired of doing same thing every time when I want to see my database.

./adb shell run-as com.example.wow

chmod 777 databases

cd databases

chmod 777 myDB.db

exit

cat /data/data/com.example.wow/databases/myDB.db > /sdcard/myDB.db

exit

./adb pull /sdcard/myDB.db /Users/

Try something like that:

#! /bin/bash

cat <<EOF | adb shell
run-as com.example.wow
chmod 777 databases
cd databases
chmod 777 myDB.db
exit
cat /data/data/com.example.wow/databases/myDB.db > /sdcard/myDB.db
exit
EOF
adb pull /sdcard/myDB.db /Users/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM