When using Tasker as a clipboard manager I made a shell script which reads the last clipping (also successfully captured by Tasker, in /storage/emulated/0/clipper/clip.txt
). This I append to a file with all clippings with a maximum of 300 lines.
I use the oneliner command:
( tail -n 300 /storage/emulated/0/clipper/clipall.txt ; echo ______$(date +"%Y-%m-%d %T")_______ ; cat /storage/emulated/0/clipper/clip.txt ) > /storage/emulated/0/clipper/clipall.txt
to add the last clipping on the bottom and each clipping separated by the current timestamp surrounded by underscores. Running this oneliner in a Termux shell is successful, but not as a Tasker => Run Shell command, so now I use the Termux plugin for Tasker and it can be run from Tasker. But without the 'help' of Termux it cannot run.
It is rather standard shell script, because the same script (with another directory obviously) runs on my Mac as well.
There is no root involved. Does Tasker have limited shell capabilities ?
/storage/emulated/0
from within an app is no longer possible on Android 10/11. – Robert Jun 23 '21 at 13:04/storage/emulated/0
as I granted Tasker 'storage access'. Well I tried to by enabling 'store error in %err' and then 'Flash $err', but it stopped before showing %err. I'll try to debug it by splitting it up into more lines. – php and js Jun 24 '21 at 06:16
– php and js Jun 24 '21 at 06:30( tail -n 300 /storage/emulated/0/htdocs/clipper/clipall.txt ; echo ______$(date +"%Y-%m-%d %T")_SEP______ ; cat /storage/emulated/0/htdocs/clip.txt ) > /storage/emulated/0/Download/z && mv /storage/emulated/0/Download/z /storage/emulated/0/htdocs/clipper/clipall.txt