mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Support user prompt in fallback precmd emulation
This commit is contained in:
parent
dad5c64f6b
commit
b4c318d761
@ -1152,18 +1152,19 @@ init_subshell_precmd (char *precmd, size_t buff_size)
|
||||
*/
|
||||
static const char *precmd_fallback =
|
||||
" " /* Useful if the shell supports HISTCONTROL=ignorespace like functionality */
|
||||
"MC_PS1_SAVED=\"$PS1\"; " /* Save custom PS1 */
|
||||
"precmd() { "
|
||||
"if [ ! \"${PWD##$HOME}\" ]; then "
|
||||
"MC_PWD=\"~\"; "
|
||||
"else "
|
||||
"[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; "
|
||||
"fi; "
|
||||
"echo \"$USER@$(hostname -s):$MC_PWD\"; "
|
||||
"echo \"${MC_PS1_SAVED:-$USER@$(hostname -s):$MC_PWD\\$ }\"; "
|
||||
"pwd>&%d; "
|
||||
"kill -STOP $$; "
|
||||
"}; "
|
||||
"PRECMD=precmd; "
|
||||
"PS1='$($PRECMD)$ '\n";
|
||||
"PS1='$($PRECMD)'\n";
|
||||
|
||||
switch (mc_global.shell->type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user