Last active
March 23, 2018 22:58
-
-
Save nicerobot/1484713 to your computer and use it in GitHub Desktop.
Abbreviating PROMPT_COMMAND with ${HOME} to ~ replacement using perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROMPT_COMMAND='PS1X=$(perl -p -e "s|^${HOME}|~|;s|([^/])[^/]*/|$""1/|g" <<<${PWD})' | |
PS1='\j \u@\h:${PS1X} ' | |
# http://unix.stackexchange.com/a/26860/6128 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment