I have added an alias command to kill my guake terminal to my .bashrc
alias killguake="kill -9 $(ps aux | grep guake | head -n -1 | awk '{print $2}')"
But the problem is, the sub-command i.e. ps aux | grep guake | head -n -1 | awk '{print $2}' is executed at the time of terminal startup and killguake is set to kill -9 result_of_subcommand.
Is there any way to set it like so, that the sub command is run/calculated every time I run killguake? So that it can have the latest PID for the guake.
I have also tried piping to the kill using xargs but that also result in same, that is calculating everything at startup. Here is what I tried with piping
ps aux | grep guake | head -n -1 | awk '{print $2}' | xargs -I{} kill -9 {}
'instead of double-quotes". – F. Hauri 7 hours agohead, use grep like thisgrep [g]uake. – richard 3 hours ago[g]means? – Muhammad Tahir 2 hours agopidofreplace that long command sequence? As inkill -9 $(pidof guake), or even better,pkill? – wingleader 2 hours ago