Set Bash As Default Shell
Jun 25, 2017 - So no matter how you try to set zsh as the default shell through chsh -s $(which zsh), it doesn't work if you still call to bash.exe everytime you. In Red hat Linux the default shell you login to is /bin/bash but in case you want to change the default login shell follow the below proced. In Red hat Linux the default shell you login to is /bin/bash but in case you want to change the default login shell follow the below procedure.
Is out now, and includes a variety of exciting new features. For example, a new integrated Terminal that allows you to stay within VS Code while using your platform’s shell.
You may have also heard that in the current Windows Insider Preview.
When adb shell is executed, the Android side also launches adb which then executes /system/bin/sh. This path is hard-coded in system/core/adb/services.c: 347 #if ADBHOST348 #define SHELLCOMMAND '/bin/sh'349 #define ALTERNATESHELLCOMMAND '350 #else351 #define SHELLCOMMAND '/system/bin/sh'352 #define ALTERNATESHELLCOMMAND '/sbin/sh'353 #endifIf you want to change this to bash, you will have to recompile it.It is possible to execute some commands from file when running the interactive shell. As written in system/core/sh/main.c, sh - (note the - for interactive mode) reads from the following files (in this order):. /etc/profile.profile (relative to current directory, this is /.profile for adb shell.
$ENV (environment variable ENV should point to a file)As /etc/ and / are read-only, the only way to get something loaded was by setting ENV. You can probably create a symlink from /etc/profile to /data/profile by mounting / read-write (exercise for the reader).
This is an old question, but I was recently curious about this myself. I found a method that doesn't require recompiling adbd, however it does require su (I'm using Chainfire SuperSu 2.45).Assuming bash is located at /system/bin/bash, and su is at /system/xbin/su, it's essentially something like this:. adb shell (use an interactive shell. Invoking this process as aone-liner could cause ADB to cease working if there is a problem). mount -o remount,rw /system. mv /system/bin/sh /system/bin/sh.bak. echo -e '#!/system/bin/bashn/system/xbin/su -mm -l -s /system/xbin/bash' /system/bin/sh Note that your paths may differ; use which bash and which su to be sure.
Set Bash As Default Shell Vscode
chmod 777 /system/bin/sh. Test the shell before you exit: /system/bin/sh. If you get an error, fix the error or revert by restoring the backup: cp /system/bin/sh.bak /system/bin/sh. Optionally remount /system; most devices will do this automatically:mount -o remount,ro /systemAnd you're done.Simply symlinking BASH to SH doesn't work because bash emulates SH when invoked this way.However, having a look at strace, it does seem to look for a bashrc when a symlinked BASH is called as 'sh -login'. While this could conceivably be used to 'chainload' shells via script, as mentioned above the way adbd invokes SH is hardcoded.If there is a problem and you have removed (or moved) /system/bin/sh ADB wont have a shell to give you to fix the problem. If this happens, you have a few options:. Reboot into a recovery that has adbd (such as CWM or TWRP) and open an adb shell to it, to copy /system/bin/sh.bak over to /system/bin/sh again.
Use adb to copy the backup: adb root; adb remount; adb shell; adb pull /system/bin/sh.bak; adb push sh.bak /system/bin/sh Note that this won't work on all devices; some refuse to allow adb to remount /system rw in this way. Use a terminal emulator that can be set to run a different shell; note that several will try /system/bin/sh first and force close.