I'm trying to set an
export that would effectively
kill a process based on the PID that
pgrep feeds it. Running the command
kill $(pgrep myAppName) appears to work (if 'myAppName' were the name of an actual running process)... But how would you save this command as an exported environment variable? Every variation of the command that I could think of seems to try and evaluate
pgrep myAppName into something like
20137 (or a similar PID value), and running the exported variable works the first time, but obviously won't work after that since the exported command is actually
kill 20137, where that process has already been terminated.
How can I get this to be properly saved in a variable, so I can just type something like
$KILL_APPNAME to kill that process, every single time the command is run?