0

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 ?

  • 1
    What Android version do you use? Access to /storage/emulated/0 from within an app is no longer possible on Android 10/11. – Robert Jun 23 '21 at 13:04
  • Did you debug Tasker? Split your command into multiple lines and execute each of them wherever file access is requested. Save output and error in global variables so that you can see the error Tasker reported. I have Tasker 5.9 (not updated) on Android 10 and I get no problem with that one liner. – Firelord Jun 23 '21 at 16:46
  • I have Android 10, but no problem with accessing /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
  • SOLVED: I forgot to add a path preceding the temporary file called 'z'. The script working correctly is now:

    ( 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

    – php and js Jun 24 '21 at 06:30

0 Answers0