I'm running Android 13. When I run adb shell in a USB connection from my desktop machine to my Android device, the following is the value of the PS1 variable that gets automatically set:
${|
local e=$?
(( e )) && REPLY+="$e|"
return $e
}$HOSTNAME:${PWD:-?} $
I can see how this particular setting of PS1 relates to the generated shell prompt in adb shell, but still want to know all of the details of PS1 syntax.
Can anyone point me to the full documentation of PS1 as it's utilized in adb shell?
For example, one thing that I'd like to understand is how the vertical bars work within that PS1 setting. The second vertical bar seems like it might indicate a termination of the text which follows the first vertical bar, even though this second vertical bar appears to be nested within a double-quoted string. But that's just a guess which might be incorrect. And whatever these vertical bars actually mean, I'd still also like the full docs, so that I can understand all of the PS1 syntax that's used in adb shell.
Also, if I re-set PS1 to be the same value as above, except with the vertical bars removed, I then always get the following error message when running every command that is run within adb shell:
: can't create temporary file /data/local/shXXXXXX.tmp : Permission denied
where "XXXXXX" are 6 randomly generated base-36 characters, and where the displayed shell prompt is then only a single dollar sign. Therefore, these vertical bars relate to file/directory access permissions, maybe involving some kind of evaluation being performed as root.
If there is no such full documentation, where is the official Google source code for ADB itself and/or the official Google source code specifically for the shell that's used within ADB sessions?