Skip to content

Prints a shortened version of the current working directory.

Notifications You must be signed in to change notification settings

andersjel/small-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Readme

This program prints the current working dir to the standard output, shortening it nicely if it is too long. It can be used to build a nice bash prompt. E.g.

/home/johndoe/documents/some-project/src/

becomes

.../some-project/src/

Installation

These instructions apply to Debian based systems.

If you need g++ run sudo apt-get install g++. Compile the program by executing

g++ small-prompt.cpp -o small-prompt

To use this as your bash prompt, put it somewhere in your PATH (for instance, create ~/bin/ and put it there). Now run

echo 'PS1="$(small-prompt 30)\$ "' >> ~/.bashrc

If you want a color version, instead run

echo 'PS1="\[\033[0;31m\]\$(small-prompt 30)\$\[\033[0m\] "' >> ~/.bashrc

Restart your session for the change to take effect.

About

Prints a shortened version of the current working directory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages