samedi 28 février 2015

Custom PS1: usual PS1 for all directories excluding single directory with subdirectories


Vote count:

0




Consider fixed absolute path to some directory with arbitrary subdirectories:



/full/path/to/fixed/directory
/full/path/to/fixed/directory/first_subdirectory
/full/path/to/fixed/directory/first_subdirectory/second_subdirectory


and arbitrary other directory that is not subdirectory of foregoing directory: /other/path


I want see the following in the terminal:



user@host: .../directory$
user@host: .../directory/first_subdirectory
user@host: .../directory/first_subdirectory/second_subdirectory
user@host: /other/path$


where the last line is a typical case but other lines are instead of



user@host: /full/path/to/fixed/directory$
user@host: /full/path/to/fixed/directory/first_subdirectory
user@host: /full/path/to/fixed/directory/first_subdirectory/second_subdirectory


How to implement it?


P.S. Paths can contain whitespaces.



asked 1 min ago







Custom PS1: usual PS1 for all directories excluding single directory with subdirectories

Aucun commentaire:

Enregistrer un commentaire