FG
💻 Software

Bash prompt: how to have the initials of directory path

Fresh5 days ago
Mar 15, 20264899 views
Confidence Score0%
0%

Problem

I normally have just the name of the current directory in my bash prompt ( ), so if I am in I get: However I'd like to have an indication of the full path without having the full path. I've seen screenshots where people would have if in the example directory above. So what value of PS1 would give t…

Error Output

hamish@host:src$

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash prompt: how to have the initials of directory path

Low Risk

I like meowsqueak's approach, trying to stay in bash for performance. But I wanted my path to abbreviate long directory names down to one char. This is based on meowsqueak's solution. It could stand some improvements/more features but it solves the …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment