Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add something automatically to the end of bash command

Tags:

bash

I would like to know how to add something to the end of a specific bash command without having to type it out explicitly.

For example, I would like to be able to type:

$ mycommand argument

and the line will be submitted as:

$ mycommand argument &

I know how to set up an alias in my .bashrc (e.g. alias command="command -i") which will let me add non-positional arguments but I can't figure out how add something to the end.

like image 221
otocan Avatar asked Sep 20 '25 06:09

otocan


1 Answers

Define a shell function.

mycommand () {
  command mycommand "$@" &
} 
like image 135
chepner Avatar answered Sep 22 '25 21:09

chepner