Run Termux Command with Termux:Tasker

by AFPing

Version 1 (March 26, 2021)

Download (63 downloads)

I think this is the best way to run Termux commands with Automate.

PROS:
- you can send parameters and receive the stdout, stderr and exitcode of the scripts.
- You can install and use any package from termux, like NodeJS or Python.

CONS:
- You have to install the Termux:Tasker plugin.

Steps:

1) Go to Playstore and install Termux.

2a) Go to FDroid and install the Termux:Tasker plugin. https://f-droid.org/en/packages/com.termux.tasker/

2b) You can also install Termux:Tasker from the playstore but it costs like 2 dollars.

3) Open Termux and run: mkdir -p ~/.termux/tasker

4) Create a shell script with: nano ~/.termux/tasker/test.sh

The following two lines are the content of the test.sh script from this example:

##### begin test.sh
#!/data/data/com.termux/files/usr/bin/sh
echo $1
##### end test.sh

5) Give execution permission to the script with running: chmod u+x ~/.termux/test.sh

6) Check out the content of this flow

IMPORTANT: The reason behind the expression that validates if ex != null is that sometimes Automate doesn't execute the script. It is weird but it happens sometimes. So this ensures that the script is actually executed.

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Reviews and ratings can be submitted in the app.