6

I would like to be able to define arbitrary modifications to command lines that happen before bash sees them at all, ie, before expansion of any kind. Is this possible?

I'm not trying to solve one particular problem, I'm really just curious if it is possible to obtain exactly this functionality without writing my own shell.

  • What kind of modifications? If you just want shortcuts to things, use alias. – jtbandes Jul 24 '10 at 21:13
  • >"before expansion of any kind." I would like to do complete rewriting of entire command lines. Aliases and shell functions are the limitation I am trying to overcome. – Personman Jul 24 '10 at 21:28
  • related: superuser.com/questions/175799/… – poindexter Apr 30 '12 at 14:10
2

I would suggest that you investigate the possibility of binding the readline function accept-line (Ctrl-m) into the Bash completion facility (readline complete) where you would be able to process the line and should be able to execute it from there.

  • Can you give an example of how one would do this? Are you suggesting using a bind command to change the behavior of C-m? Or are you suggesting that complete offers some way to intercept accept-line? – poindexter Apr 27 '12 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.