![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to use find commnad to show only path of the result | umen | UNIX for Dummies Questions & Answers | 1 | 02-05-2008 12:22 AM |
| Secondary groups show in groups but don't show in id (Not working) | zen03 | HP-UX | 4 | 12-31-2007 08:15 AM |
| Show path name | p.vvugt | UNIX for Dummies Questions & Answers | 2 | 12-19-2007 02:11 AM |
| vi - replacing a relative path with absolute path in a file | Yinzer955i | UNIX for Dummies Questions & Answers | 2 | 09-07-2006 08:47 AM |
| How would I make a find command NOT show the path of a file? | LordJezo | Shell Programming and Scripting | 1 | 10-01-2004 03:01 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PS1 to show relitive path
Hi I am trying to format my prompt in a KSH to show the relative path
currently it is PS1='$PWD >' /home/users/dir/dir/dir > I want to display it as /home/users/.../.../dir > |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You can have fun with your PS1 prompt by creating a function which changes PS1 each time you change directory, e.g...
Code:
function ncd {
cd "$*"
PS1=$(echo $PWD|sed 's!\([^/]\)[^/]\{4,\}/!\1../!g')' :> '
}
alias cd=ncd
|
|
#3
|
|||
|
|||
|
Thanks that helped a lot
|
|||
| Google The UNIX and Linux Forums |