Just a minor issue. I'm writing a simple bash script that starts and stops Jetty. When I execute it, the script immediately puts my cursor back on the bash prompt. However, as Jetty starts up and writes its initialization output back to stdout, it leaves the cursor on a line of its own (without a prompt) until I enter a command or hit enter. Nitpicking, I know, but I figure there's an easy way to avoid this that I'm missing.
Here's the script:
#!/bin/bash
cd /opt/jetty/jetty-distribution-7.4.5.v20110725/
if [ "$1" = "-stop" ]
then
java -DSTOP.PORT=8079 -DSTOP.KEY=something -jar start.jar --stop
else
java -DSTOP.PORT=8079 -DSTOP.KEY=something -jar start.jar &
fi
Here's the output:
[user@machine ~]# jetty
[user@machine ~]# 2011-08-11 14:47:34.818:INFO::jetty-7.4.5.v20110725
2011-08-11 14:47:34.866:INFO::Deployment monitor /opt/jetty/jetty-distribution-7.4.5.v20110725/webapps at interval 1
2011-08-11 14:47:34.878:INFO::Deployment monitor /opt/jetty/jetty-distribution-7.4.5.v20110725/contexts at interval 1
2011-08-11 14:47:34.883:INFO::Deployable added: /opt/jetty/jetty-distribution-7.4.5.v20110725/contexts/javadoc.xml
2011-08-11 14:47:34.934:INFO::started o.e.j.s.h.ContextHandler{/javadoc,file:/opt/jetty/jetty-distribution-7.4.5.v20110725/javadoc}
2011-08-11 14:47:34.935:INFO::Deployable added: /opt/jetty/jetty-distribution-7.4.5.v20110725/contexts/test.xml
2011-08-11 14:47:35.011:INFO::Extract jar:file:/opt/jetty/jetty-distribution-7.4.5.v20110725/webapps/test.war!/ to /tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp
2011-08-11 14:47:35.645:INFO::started o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/},/opt/jetty/jetty-distribution-7.4.5.v20110725/webapps/test.war
2011-08-11 14:47:36.127:INFO:org.eclipse.jetty.servlets.TransparentProxy:TransparentProxy @ /javadoc to http://download.eclipse.org/jetty/stable-7/apidocs
2011-08-11 14:47:36.199:INFO::Started SelectChannelConnector@0.0.0.0:8080 STARTING
And the cursor ends up on a blank new line just below. Is there a way to prevent this? I'm pretty new to bash scripting, is there something I should be doing that I'm not?