Shell script issue

I ran to a bug ig? It's when I ran this shell script and save it to a car in MD it saves not even halfway of the data.

Here's an example script:
Cat some_file.txt

Note that the file has let's say around 3k but it shows under 400? But when I ran the same script on a terminal it displays everything, so any alternative to that since it might not get fixed sooner?


Thanks inn advance
 

tanutanu

Well-known member
I ran to a bug ig? It's when I ran this shell script and save it to a car in MD it saves not even halfway of the data.

Here's an example script:
Cat some_file.txt

Note that the file has let's say around 3k but it shows under 400? But when I ran the same script on a terminal it displays everything, so any alternative to that since it might not get fixed sooner?


Thanks inn advance
if you are a beta tester and using MD v5.19.x, you have to use helper v1.7. It supports to access a file which made by another app on shared directory under SDK30 new regulation. If not, cat command doesn't output anything on stdout. Even though terminal console write the text correctly to stdout, it's not relevant to MD(helper) internal shell calling because the terminal app is just a different app.
 
if you are a beta tester and using MD v5.19.x, you have to use helper v1.7. It supports to access a file which made by another app on shared directory under SDK30 new regulation. If not, cat command doesn't output anything on stdout. Even though terminal console write the text correctly to stdout, it's not relevant to MD(helper) internal shell calling because the terminal app is just a different app.
Apparently I'm not a beta tester and I still tried if MD helper will work but no hope it shows not nearly have of the data in the file again
 

tanutanu

Well-known member
Apparently I'm not a beta tester and I still tried if MD helper will work but no hope it shows not nearly have of the data in the file again
If your MD is v5.18.x or below, it is based on SDK29. It means you don't need v1.7 helper, v1.5 or older(even not installed for shell script) is ok. I guess you revoked file access permission accidentally if you got nothing.
If you mean "halfway" as around the half of your data file and you got a specific length of data but NOT all of them in a variable, sorry I have no idea. You can use termux as the plugin alternatively.
 
If your MD is v5.18.x or below, it is based on SDK29. It means you don't need v1.7 helper, v1.5 or older(even not installed for shell script) is ok. I guess you revoked file access permission accidentally if you got nothing.
If you mean "halfway" as around the half of your data file and you got a specific length of data but NOT all of them in a variable, sorry I have no idea. You can use termux as the plugin alternatively.
But I can't store the data in MD variable if I use termux
 

tanutanu

Well-known member
But I can't store the data in MD variable if I use termux
Why not? It can return a value writing it to stdout, just same as MD builtin shell when working as a plugin.
 

Attachments

  • Screenshot_20211118-151609~2.png
    Screenshot_20211118-151609~2.png
    44 KB · Views: 16

tanutanu

Well-known member
How did you use termux as a plugin btw?
Nothing special. Just install Termux:Tasker with Termux itself via F-droid. You'd better be googling about post install instructions.
 

Attachments

  • IMG_20211118_204828.jpg
    IMG_20211118_204828.jpg
    255.9 KB · Views: 12
  • IMG_20211118_204859.jpg
    IMG_20211118_204859.jpg
    224.4 KB · Views: 11
Nothing special. Just install Termux:Tasker with Termux itself via F-droid. You'd better be googling about post install instructions.
Hey I installed the tasker but I'm confused on how to execute commands, I found instructions on how to execute commands using tasker but in macrodroid it's confusing can you help me?
 

tanutanu

Well-known member
Hey I installed the tasker but I'm confused on how to execute commands, I found instructions on how to execute commands using tasker but in macrodroid it's confusing can you help me?
Why do you install Tasker? Tasker and Termux:Tasker are different.
You can do everything by yourself just googling few times while asking me;)
 
Why do you install Tasker? Tasker and Termux:Tasker are different.
You can do everything by yourself just googling few times while asking me;)
No I mean termux:tasker
I'm confused on how to execute commands in macrodroid since all tutorials I found in google are about tasker, but ye I know now.
And here's my script


curl https://next-episode.net/arcane > web.html
mv "web.html" /sdcard/macrodroid/
sleep 3
if web.html in /sdcard/macrodroid/
then
-h=cat /sdcard/macrodroid/web.html -echo $h
else
-echo none
fi

Ignore the '-' it won't show in plain text
And it returns none but I want it to read the web.html to store it in MD var
 
Last edited:

tanutanu

Well-known member
No I mean termux:tasker
I'm confused on how to execute commands in macrodroid since all tutorials I found in google are about tasker, but ye I know now.
And here's my script


curl https://next-episode.net/arcane > web.html
mv "web.html" /sdcard/macrodroid/
sleep 3
if web.html in /sdcard/macrodroid/
then
-h=cat /sdcard/macrodroid/web.html -echo $h
else
-echo none
fi

Ignore the '-' it won't show in plain text
But it returns none which I want it to read the web.html to store it in MD var
Where do you put it on and how do you call from MD?
I don't think the shell script works though.

Frankly, I had already given you all points to kickstart, and don't want to break down step by step. I also don't like asking something just to answer your questions. You need to put everything accurately on the table before asking;)
 

tanutanu

Well-known member
No I mean termux:tasker
I'm confused on how to execute commands in macrodroid since all tutorials I found in google are about tasker, but ye I know now.
And here's my script


curl https://next-episode.net/arcane > web.html
mv "web.html" /sdcard/macrodroid/
sleep 3
if web.html in /sdcard/macrodroid/
then
-h=cat /sdcard/macrodroid/web.html -echo $h
else
-echo none
fi

Ignore the '-' it won't show in plain text
And it returns none but I want it to read the web.html to store it in MD var
I noticed the final goal is different than common text output and store it in a MD variable.
Try HTTP get action. It is more directly than using Shell script action or calling Termux:Tasker plugin. Even if you want to save it in the external storage, you can use Write to file action.
You'd better change your perspective when you encountered some difficulties, people tend to look their toe on just one step forward though;)
 

Attachments

  • Screenshot_20211119-144829~2.png
    Screenshot_20211119-144829~2.png
    139.1 KB · Views: 14
  • Screenshot_20211119-144706~2.png
    Screenshot_20211119-144706~2.png
    110.7 KB · Views: 14
Last edited:
I noticed the final goal is different than common text output and store it in a MD variable.
Try HTTP get action. It is more directly than using Shell script action or calling Termux:Tasker plugin. Even if you want to save it in the external storage, you can use Write to file action.
You'd better change your perspective when you encountered some difficulties, people tend to look their toe on just one step forward though;)
This is the first method I used in order to achieve what I want but it stores not even halfway of what I can get thru shell script or termux:tasker no worries I drop this idea since it'll be hard to maintain, thanks anyways :>
 

tanutanu

Well-known member
This is the first method I used in order to achieve what I want but it stores not even halfway of what I can get thru shell script or termux:tasker no worries I drop this idea since it'll be hard to maintain, thanks anyways :>
It doesn't seems to have problem. If you want to get contents loading via JS, you have to investigate how to do though.
I don't think the site offer you direct way to fetch them🤔
 

Attachments

  • Screenshot_20211125-014604~2.png
    Screenshot_20211125-014604~2.png
    72.1 KB · Views: 8
  • Screenshot_20211125-014538~2.png
    Screenshot_20211125-014538~2.png
    101.2 KB · Views: 8
It doesn't seems to have problem. If you want to get contents loading via JS, you have to investigate how to do though.
I don't think the site offer you direct way to fetch them🤔
I found a way that can read a file and save it as a md var without data loss, by adding '&' like:
cat ur-file.txt &

it makes the operation to run in background
 

tanutanu

Well-known member
I found a way that can read a file and save it as a md var without data loss, by adding '&' like:
cat ur-file.txt &

it makes the operation to run in background
I don't think it guarantee to store entirely though. The last ampersand on UNIX shell means just running it in the background. So, it still depends on timing and data length.
I believe one reliable way is setting enough longer timeout and blocking next until complete.
 
Top