I tried to make alias with quotes as following:
alias myalias='ps -ef | grep tomcat | kill -9 `awk {'print $2'}`'
but as you can see i already have '
in awk
so i tried to replace
awk {'print $2'}
with
awk {"print $2"}
but then strange things happen to me when i run this alias, ie, the console window get closed... how can i make this alias work
awk {print\ \$2}
killall tomcat
?pkill tomcat
...killall
doesn't always do what you think it does, so I think it's a bad habit to get into. (On some unixes, it is the equivalent ofshutdown
...)