0

I know bashrc is executed on terminal startup. But my use case is something like this,
To execute a specific command, say ls, whenever user executes another specific command, say cd, on the terminal.

My current solution is overriding cd command. But again that I feel is not a good solution. But my restriction here is that my user-group may not be aware of this new command that I may create and continue using cd.

swayamraina
  • 101
  • 1
  • Possible, but not a good idea to override commonly-used builtins. Rather create a new function like `cdl`. – slhck Jun 05 '18 at 07:12
  • Updated my question a bit. I already have overrided the `cd` command but I am hoping there may be a better solution. – swayamraina Jun 05 '18 at 07:22
  • Either the builtin is overridden and then `cd` can do something else, or it's not overriden and then `cd` is just a regular `cd`. Are you asking how to force other users to use your overridden `cd`? – Kamil Maciorowski Jun 05 '18 at 08:05
  • So, Yes I think I can take a flag which will decide this enhanced behaviour of `cd` – swayamraina Jun 05 '18 at 08:30

0 Answers0