Hi I need to run things in the form of adb shell <command>
When I test everything out inside adb shell, it works because I was able to set some aliases in .bashrc
.
However, when I do adb shell <command>
, nothing works because .bashrc
is not used when you run adb shell <command>
, because it's in the non-interactive mode.
How can I work around this? Can I adb push
some files to the filesystem so that the alias will be there when adb shell
is run?
One way to do this is to issue several shell commands in a single ADB command. You can put them in a string, and separate them with semicolons, thus:
adb shell "alias foo bar ; export MY_VARIABLE=/path/to/somewhere ; my_executable "
The
"
are crucial here, make sure they are paired up correctly. You could run your.bashrc
this way, thus:adb shell "source /path/to/.bashrc ; my_executable"