Android Shell EOF

I have a little problem with the script I'm doing for Android. I can’t seam to get "EOF" to work in "mksh". It works fine in "sh" and "bash", but since "mksh" is becoming the most popular in Android, I really need it to work in all.

cat <<EOF
  ... lines here ...
EOF

In this example, an error will occur

cannot create a temporary file / sqlite _stmt_journals / mksh. (random): there is no such file or directory

I have seen others with this problem, but no real solution.

+5
source share
4 answers

- , /sqlite _stmt_journals , /tmp Unix boxen, TMPDIR, mksh Android.

Android .

( Android ) , ; "" , () , , - .

, TMPDIR , .

Android, mksh .

@Julian Fondren: Android, , , .

AOSP git master, TMPDIR /data/local, , , root... - ( , ).

+10

, , : docs; . , :

echo ... first line ... > $tmpfile
echo ... subsequent lines ... >> $tmpfile
cat $tmpfile
rm $tmpfile

EDIT: , ? , , , mksh. mksh R39 Kindle Fire HD ( perl):

$ perl <<FOO
print "hi\n"
FOO
hi
$ 

, .

+2

1) root:

Android, , root , adb root.

adb root

adb shell

.

2) if you can change the sh binary in your Android device, then change it so that it finds the path

/data/local/tmp/

or

/data/local/atvc/  // In Motorola’s android device.

the above directory has read / write / execute permissions for the shell user.

3) Install Busybox and run it as Busybox cat <<EOF

+1
source

from this post:

package=com.tayek.tablet.gui.android.cb7
cat <<EOF | adb -s 0a9196e8 shell
run-as $package
ls -l /data/data/$package
exit
exit
EOF
0
source

All Articles