Sample Header Ad - 728x90

Using Here Documents in Termux

1 vote
0 answers
229 views
I'm trying to run commands in a script that needs to be run as superuser. I tried doing this with here documents but wasn't successful. ( I used to be able to use it with tsu in Termux). Does anyone know a reason why it shouldn't work or a way to get it to work. Here is the code that used to work but doesn't work anymore. #!/data/data/com.termux/files/usr/bin/bash ... begining of script Just some regular commands sudo touch s tsu s exit EOF echo after here doc The results currently from this script is echo "Test" > s exit after here doc The 2 first lines should not appear at all and they should be in the file s. But the file s is empty. I have also tried the following code but with the same results. sudo touch s sudo -s s exit EOF echo after here doc I have also googled this and haven't found anything to help me. All suggestion work in regular linux but not in Termux. Here is one example of what I have tried. Any suggestion or help will be appreciated.
Asked by Sruly (1028 rep)
Oct 22, 2020, 05:19 PM