diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index 73ca06828f..db6b3c2cee 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ #define CSWTCH 0 #endif +const char *kDefaultShell = "/bin/sh"; /* * Set environment variable. @@ -335,10 +337,20 @@ initialize_termios(struct termios &tio) status_t Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **argv) { - const char *kDefaultShellCommand[] = { "/bin/bash", "--login", NULL }; - if (argv == NULL || argc == 0) { - argv = kDefaultShellCommand; + const char *defaultArgs[2]; + defaultArgs[0] = kDefaultShell; + defaultArgs[1] = "-l"; + + struct passwd passwdStruct; + struct passwd *passwdResult; + char stringBuffer[256]; + if (!getpwuid_r(getuid(), &passwdStruct, stringBuffer, + sizeof(stringBuffer), &passwdResult)) { + defaultArgs[0] = passwdStruct.pw_shell; + } + + argv = defaultArgs; argc = 2; } @@ -538,8 +550,8 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg int returnValue = system(alertCommand.String()); if (returnValue == 0) { - execl(kDefaultShellCommand[0], kDefaultShellCommand[0], - kDefaultShellCommand[1], NULL); + execl(kDefaultShell, kDefaultShell, + "-l", NULL); } exit(1); diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index b7f391e26d..a4fded3c01 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -10,7 +10,6 @@ #include "TermApp.h" #include -#include #include #include #include @@ -39,7 +38,6 @@ static bool sUsageRequested = false; //static bool sGeometryRequested = false; -const char *kDefaultShell = "/bin/bash"; const ulong MSG_ACTIVATE_TERM = 'msat'; const ulong MSG_TERM_WINDOW_INFO = 'mtwi'; @@ -63,19 +61,8 @@ TermApp::TermApp() fTermWindow(NULL), fArgs(NULL) { - const char *defaultArgs[2]; - defaultArgs[0] = kDefaultShell; - defaultArgs[1] = "--login"; - struct passwd passwdStruct; - struct passwd *passwdResult; - char stringBuffer[256]; - if (!getpwuid_r(getuid(), &passwdStruct, stringBuffer, - sizeof(stringBuffer), &passwdResult)) { - defaultArgs[0] = passwdStruct.pw_shell; - } - - fArgs = new Arguments(2, defaultArgs); + fArgs = new Arguments(0, NULL); fWindowTitle = B_TRANSLATE("Terminal"); _RegisterTerminal();