Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/data/data/com.termux/files/usr/bin/sh
- if [ -z "${1}" ]; then echo "[BŁĄD]: podaj nazwę pliku"; exit 1; fi
- FILE="`realpath -q ${1}`"
- if [ ! -f "${FILE}" ]; then touch "${FILE}"; IS_NEW="true"; fi
- APK="com.rhmsoft.edit"
- STAT_A=`stat -c %Y "${FILE}"`
- if am start -n "${APK}/${APK}.activity.MainActivity" -d "file://${FILE}" > /dev/null 2>&1; then
- sudo sh -c "while pidof -s -q ${APK}; do sleep 2; done"
- else
- echo "[BŁĄD]: nie można uruchomić \"${APK}\""
- fi
- STAT_B=`stat -c %Y "${FILE}"`
- if [ -n "${IS_NEW}" ] && [ "${STAT_A}" -eq "${STAT_B}" ]; then rm -f "${FILE}"; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement