Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Linux 命令的新手。我有一个要求,我想使用 shell 脚本启动 Tomcat。文件的位置startup.sh在/usr/lib/apache-tomcat-7.0.14/bin/. Tomcat 开始使用 command sh startup.sh。我想创建一个 shell 脚本,以便它将转到该文件夹并执行sh startup.sh命令。如何使用 shell 脚本执行此操作?任何人都可以分享这样做的脚本吗?
startup.sh
/usr/lib/apache-tomcat-7.0.14/bin/
sh startup.sh
你是认真的?
#!/bin/bash cd /usr/lib/apache-tomcat-7.0.14/bin/ sh startup.sh
#!/bin/bash exec /usr/lib/apache-tomcat-7.0.14/bin/startup.sh
更简单(因为没有外壳)