.profile

Luciano Rocha strange at nsk.no-ip.org
Wed Aug 8 16:20:00 UTC 2007


On Wed, Aug 08, 2007 at 11:16:19AM -0400, Steven W. Orr wrote:
> On Wednesday, Aug 8th 2007 at 14:45 -0000, quoth tony.chamberlain at lemko.com:
> 
> =>Does anyone know whether linux has something like a .profile but for cd?
> =>
> =>That is, you put a script into a directory which gets executed every 
> =>time someone CDs to that directory?
> 
> It does not, but that doesn't mean you can't write one:
> 
> Add (something like) this to you .bashrc
> 
> cd ()
> {
>     builtin cd $1 || return
>     [[ -f ./.init ]] && . ./.init   
> }

or use PROMPT_COMMAND:
PROMPT_COMMAND='[ "$old_pwd" != "$PWD" -a -O .cdprofile ] && . .cdprofile;
old_pwd="$PWD";'"$PROMPT_COMMAND"

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070808/42e38166/attachment-0002.bin 


More information about the users mailing list