jpage@rruxe.UUCP (J. H. Page) (03/16/85)
any unix-wizards out in net.land know how to have one's UNIX prompt change to reflect a change in one's working directory. i have access to sh and ksh on our system. i know the csh alias command(s) but have had no success translating them into ksh. thanks in advance, jim page
robert@gitpyr.UUCP (Robert Viduya) (03/17/85)
>< Posted from jpage@rruxe.UUCP (J. H. Page) > any unix-wizards out in net.land know how to have one's UNIX prompt change > to reflect a change in one's working directory. > > i have access to sh and ksh on our system. > The trick here is to make the cd/chdir command change your prompt whenever it's invoked. I dunno about ksh, but SysVR2 sh won't let you and still be able to retain the same name for the cd command. The problem lies in the fact that shell-builtins are searched first, then user-functions, then $PATH. This means there's no way to intercept-and-redefine the cd command. Csh will let you because aliases are expanded before shell-builtins and path. It is possible, however, if you call your cd command something other than 'cd'. This command would call cd to change your directory and then set your prompt to the new directory. robert -- Robert Viduya Georgia Institute of Technology ...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert ...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert
gdsd1@homxb.UUCP (M.LAI) (03/18/85)
Change the #defined value of PS1NOD in ksh/sh/builtins.h to that
of PWDNOD.
62c62
< #define PS1NOD (bltin_nodes+1)
---
> #define PS1NOD (bltin_nodes+5)
Cheap, but it works. I personally find it annoying.
Neal Nuckolls
..!houxa!homxb!gdsd1
dougu@daemon.UUCP (Doug Urner) (03/21/85)
Try this: ncd() { 'cd' $1 ; PS1="[$PWD] " ; } alias cd=ncd -- Doug Urner Small Systems Support Group, Tektronix, Inc (503)627-5037 ..!{decvax,ucbvax}!tektronix!dougu