How to make 'adb shell' to read /etc/profile or other configuration files?
0
votes
3
answers
523
views
I am working on an embedded Linux system (kernel-5.10.24), and it uses
ash
from busybox
as /bin/sh
. The system support login from serial console and adb shell
from PC.
Now I found the shell
started from serial console did read the environments defined in /etc/profile
, but the shell
started by adb shell
does NOT.
For example, the /etc/profile
is as follows,
# cat /etc/profile
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
if [ "$PS1" ]; then
if [ "id -u
" -eq 0 ]; then
export PS1='# '
else
export PS1='$ '
fi
fi
in serial console,
# echo $HOME
/root
# echo $ENV
# echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin
But in adb shell
,
/sys/kernel/config/usb_gadget # echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin
/sys/kernel/config/usb_gadget # echo $HOME
/
The shell started by adb shell
is launched by adbd
in target Linux, so is there a way to make the shell started by adb shell
to read /etc/profile
or other configuration files for its environments?
Asked by wangt13
(631 rep)
Aug 25, 2023, 03:11 AM
Last activity: Mar 2, 2024, 11:13 AM
Last activity: Mar 2, 2024, 11:13 AM