Im trying to write a bash script and trying to take input from user and executing a kill command to stop a specific tomcat.
...
read user_input
if [ "$user_input" = "2" ]
then
ps -ef | grep "search-tomcat" |awk {'"'"'print $2'"'"'}| xargs kill -9
echo "Search Tomcat Shut Down"
fi
...
I have confirmed that the line
ps -ef | grep "search-tomcat"
works fine in script but:
ps -ef | grep "search-tomcat" |awk {'"'"'print $2'"'"'}
doesnt yield any results in script, but gives desired output in terminal, so there has to be some problem with awk command
awk '{print "\047" $2 "\047"}'? - Jose Ricardo Bustos M.pkillcommand available? - anubhavapkill -9 -f "search-tomcat"- anubhava{}tool in the edit box menu at the top left on highlighted text get get properly formatted code, data, output and error msgs ;-) Good luck! - shellter