I would like to setup a tasker profile to check every predetermined time for any apps not on my approved list (BaselineApps.txt) and uninstall them. I am a noob to shell scripting and tasker. This is what I got so far, it might not be the most efficient way to do it.
I run the following command via Termux Task plugin.
pm list packages >/storage/emulated/0/Apps.txt diff --unchanged-line-format= --old-line-format= --new-line-format='%L' /storage/emulated/0/BaselineApps.txt /storage/emulated/0/Apps.txt | sed 's/^[^:]*://' >/storage/emulated/0/NewApps.txt
Read file NewApps.txt to variable %Apps
ArraySet %Apps value %Apps
For each %eachapp in %Apps()
- Run Shell pm uninstall %eachapp
- End for
For the most part it works, except it errors out sometimes. Can someone help me?