• # PROMPT_DIRTRIM

    Posté par . En réponse à la dépêche LiquidPrompt version 1.0. Évalué à 8.

    Hello!

    Ca vaut ce que ça vaut, mais tu pourrais peut-être simplifier ta fonction __shorten_path() en utilisant la variable PROMPT_DIRTRIM:

    PROMPT_DIRTRIM
     If set to a number greater than zero, the value is used as the number of trailing directory components to retain when expanding the \w and \W prompt string escapes (see PROMPTING below). Characters removed are replaced with an ellipsis.
    
    

    Par exemple:

    /usr/share/doc/bash$ export PROMPT_DIRTRIM=2
    .../doc/bash$
    
    

    PROMPT_DIRTRIM est disponible à partir de bash 4.

    My 2 cents!