diff --git a/apps/sh.cpp b/apps/sh.cpp index b827bbff..09fcf06c 100644 --- a/apps/sh.cpp +++ b/apps/sh.cpp @@ -74,7 +74,17 @@ int main(int argc, char** argv) while (1) { - if (file == "-") fputs(getuid() == 0 ? "sh# " : "sh$ ", stdout); + if (file == "-") + { + char* cwd = getcwd(NULL, 0); + if (!cwd) + { + perror("getcwd"); + return 1; + } + printf("sh %s%c ", cwd, getuid() == 0 ? '#' : '$'); + free(cwd); + } char cmd[4096]; char* rc = fgets(cmd, sizeof(cmd), f);