Termux:Tasker bash script doesn't run

iisti

New member
Hi,


I've written a test script, which I can run the script via Termux, but for some reason it doesn't run via MacroDroid and Termux:Tasker.

Hardware and software:
  • Phone Nokia G11 with Android 11
  • MacroDroid v5.26.8
  • Termux v0.118.0
  • Termux:Tasker v0.6.0

What I've done:
  1. Write a script, which should create a file name jou.txt in Termux's storage directory.
    • Bash:
      ~/.termux/tasker $ cat test.sh
      
      #!/usr/bin/env bash
      
      touch /data/data/com.termux/files/home/storage/jou.txt
  2. Set executable permission.
    • Bash:
      ~/.termux/tasker $ ls -l
      total 8
      -rwx--x--x 1 u0_a198 u0_a198  86 Aug 26 09:30 test.sh
  3. Add a macro which has a trigger "every time an SMS is received from any number".
    • Macro
    • macro_20220826-094515.png
    • Termux:Tasker
    • md_run_script_20220826-094537.png
    • Termux:Tasker variables
    • md_script_variables_20220826-094552.png
  4. Set permission to "Run commands in Termux envrionment" has been allowed for MacroDroid.
    • md_permission_given_20220826-094958.png

Does anybody have any tips?
 

iisti

New member

MacroDroidDev

Administrator
Staff member
As a first step I would suggest that you try and get this running from Tasker with the plugin. If you are able to get it running ok via Tasker then please report back here.
 

iisti

New member
I got the script running. The culprit was a bad shebang. Took me about 4 hours to realize.

#!/usr/bin/env bash doesn't work with Termux:Tasker even though it works in Termux session.

#!/usr/bin/bash works and it is in script example, but #!/data/data/com.termux/files/usr/bin/bash seems to be recommended.
 
Top