diff --git a/doc/ncdu.pod b/doc/ncdu.pod index e0ba5115bec0b89dfdef4ee64a483389bc096c6d..61a009bbcce0310cc6ca405d5e364b38732121dc 100644 --- a/doc/ncdu.pod +++ b/doc/ncdu.pod @@ -214,9 +214,15 @@ Refresh/recalculate the current directory. Spawn shell in current directory. -We first check the $SHELL environment variable of the user for the preferred -shell interpreter. If it's not set, we fall back to the compile time -configured default shell (usually /bin/bash). +We first check the $NCDU_SHELL environment variable of the user for the +preferred shell interpreter. If it's not set, $SHELL is checked. If that +variable also isn't defined, we fall back to the compile time configured +default shell (usually /bin/bash). This allows you to specify which program to +launch when 'b' is pressed. For example, if you want ncdu to execute the +Midnight Commander file manager in the current directory: + + export NCDU_SHELL=mc + ncdu =item q diff --git a/src/shell.c b/src/shell.c index eb275cd42890a79f50c2a6b42095426aaed1ba59..86d8095bf5dc6fdcb7174e53b7e4f1cf162fced7 100644 --- a/src/shell.c +++ b/src/shell.c @@ -52,9 +52,12 @@ void shell_draw() { "Press any key to continue.", full_path, res); } else { - char *shell = getenv("SHELL"); - if (shell == NULL) - shell = DEFAULT_SHELL; + char *shell = getenv("NCDU_SHELL"); + if (shell == NULL) { + shell = getenv("SHELL"); + if (shell == NULL) + shell = DEFAULT_SHELL; + } res = system(shell);