Using grep in Tasker without root

Skip to first unread message


Dec 3, 2021, 11:23:25 AM12/3/21
to Tasker
I wanted to use grep in a Run Shell Action, but Tasker has no grep, as I know.
First I tried to use grep from Termux:


but I get a file not found. Its a permission issue. Then I copied it (in two steps via the sdcard) to


and did there a chown 700 grep (had to use Run Shell Action) to make it exectuable. Here I have missing libraries e.g. - this wont work.
Then I copied busybox from termux (/data/data/com.termux/files/usr/bin/busybox) to Tasker (also via sdcard, cannot copy it from Tasker directly neither from Termux to tasker) directly to the main folder of Tasker:


and now, after chown it to make it executable, I can run grep in busybox:

/data/data/ grep

This works, for the moment, but I guess the next Tasker update flushes it away.
Very unhandy, that.

Is there some better, native, fast and reliable way to use grep in Tasker?
Latest Tasker version 5.15.5-beta on Android 9

Dec 7, 2021, 10:12:09 AM12/7/21
to Tasker
Grep is available on my device. How are you using it in a Run Shell action?

Dave W

Dec 7, 2021, 10:49:21 PM12/7/21
to Tasker
This should be a simple run shell command such as:
grep WEBP "%file"

Unix has always had its own set of special characters.  Did you forget to surround the filename with quotation marks?  HTH


Dec 21, 2021, 6:26:12 AM12/21/21
to Tasker
My error!
I tried it again without busybox, just pure grep in a very simple test and it works!

I think I had an error in my search expression so no result came but "Error: 1" in the Action after running. The error was misleading me to think, grep doesnt work without root.
I tried then a lot with busybox (see above) and thought all the time pure grep would not work, luring me far a way from the real mistake.

Now I checked it again and I found my error in the search expression of grep

grep works in Tasker, no busybox needed.


File test.csv content:
test1 line1
test2 line2

Description of the Task:

Task: TestGrepTasker
    A1: Run Shell [
         Command: grep "text" /storage/emulated/0//test.csv
         Timeout (Seconds): 5
         Store Output In: %output
         Store Errors In: %errors
         Use Global Namespace: On
         Continue Task After Error:On ]
    A2: Flash [
         Text: output: %output
         errors: %errors
         Tasker Layout: On
         Timeout: 15000
         Continue Task Immediately: On
         Dismiss On Click: On ]

None of the variables errors and output are set but in the Action (Run Shell) I see in the end Error: 1, which irritated me :)
If I search with grep for "test" or "test1" (instead of "text") I get a defined output.


Reply all
Reply to author
0 new messages