Re: .profile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx:
> 
> =>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

Attachment: pgpsxmRExnGPe.pgp
Description: PGP signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux