Skip to content

Instantly share code, notes, and snippets.

@nicerobot nicerobot/gist:1484713
Last active Mar 23, 2018

What would you like to do?
Abbreviating PROMPT_COMMAND with ${HOME} to ~ replacement using perl
PROMPT_COMMAND='PS1X=$(perl -p -e "s|^${HOME}|~|;s|([^/])[^/]*/|$""1/|g" <<<${PWD})'
PS1='\j \u@\h:${PS1X}  '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.