Sophia_ES
Sophia_ES

Reputation: 1361

Android equivalent of "/dev/stdout" and "/dev/stderr"

I realize that the files /dev/stdout and /dev/stderr do not exist on an unrooted Android device. I'm okay with that -- but I need some way to redirect input/output in my shell-scripts --- including redirecting output to output.

Is there anywhere on the Android filesystem an equivalent of these missing special-files? If there is, I can design my scripts to automatically use them rather than their traditional equivalents when running on Android --- but only if such files exist.

So does anyone know of Android equivalents of these special-files?

Upvotes: 2

Views: 2068

Answers (1)

Tatsuhiro Tsujikawa
Tatsuhiro Tsujikawa

Reputation: 404

If you are looking for the replacement of /dev/stdout and /dev/stderr, use /proc/self/fd/1 and /proc/self/fd/2 respectively (actually, in linux, /dev/stdout and /dev/stderr are symlink to those files). It works for me on my Galaxy S4.

Upvotes: 5

Related Questions