Execute a bash function upon entering a directory -


When I enter a new directory, then I want to execute a special Bash function. Something like:

  alias cd = "cd $ @ & myfunction"  

$ @ is not working There, and adding a backslash does not help. I'm also a little worried about messing with the CD, and it would be good if it works for another command which can be found in the pushd and The directory like popd was changed.

Any better aliases / commands

The easiest solution I can come up with I

  myfunction () {if ["$ PWD"! = "$ MYOLDPWD"]; Then MYOLDPWD = "$ PWD"; #striteyier stuff here .. fi} exportable PROMPT_COMMAND = myfunction  

should do this. It will work with all commands, and the prompt will trigger before the display is displayed.


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -