Reputation: 407
I want to replace complex commands with simple characters and execute in background, so I can shut down the terminal.
The command is nWave -ssf test.fsdb(fsdb is a wavefile)
. In bashrc, I write alias nwave='nWave -ssf'
.
If I want the command to be executed in background, I use nWave -ssf test.fsdb &
. How to realize this command when using alias
in bashrc file.
Upvotes: 0
Views: 378
Reputation: 14452
If you plan to close the terminal, you probably want to wrap the command in nohup
. However, using 'nohup alias ...' will not work - as nohup only accept regular command. You can embed the nohup into the alias explicitly.
# In bashrc
alias bgnwave 'nohup nWave -ssf'
# At the terminal
bgnware test.fsdb &
As an alternative to bash alias
, consider using bash function
function bgwnwave {
nohup nWave -ssf "$@" &
}
Upvotes: 1