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

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -