1

I wish to append & sign to the end of particular command (say tkdiff) whenenver I execute the command.

Please let me know what kind of alias / any other solution should I create in bashrc.

Thanks in advance.

Note: I may have few arguments to the command which i execute. & should come at the end so that I can execute in b/g and I can use the shell for any other purpose.

kumar
  • 423
  • 2
  • 9
  • 23

2 Answers2

5

You can't do this with a simple alias because the shell interprets the $@ when you define the alias. I would do this with a function in my .bashrc

tkdiff () { /usr/bin/tkdiff $@ & }
user9517
  • 114,104
  • 20
  • 206
  • 289
0
alias tkdiff='tkdiff &'

then source the .bashrc file to have it re-read and try again

edit: ok, I missed (or you added) the part about the extra arguments. You could try using $@ which is the variable holding the arguments list passed to the shell, but I have not tested this, sorry.

natxo asenjo
  • 5,641
  • 2
  • 25
  • 27