繁体   English   中英

如何在Mac中运行.bash文件?

[英]How to run .bash file in Mac?

I want to execute 
Path : "/Users/Trans/Downloads/solr-6.1.0"
Command: "bin/solr start -p 8983"
and 
Path : " /Users/Trans/Downloads/apache-activemq-5.12.0/bin"
Command: "./activemq console"

为了使它在单击时可执行,我创建了一个.command文件,其中包含

 !#/bin/bash
 "/Users/Trans/Downloads/solr-6.1.0" bin/solr start -p 8983
 "/Users/Trans/Downloads/apache-activemq-5.12.0/bin" ./activemq console

已授予chmode + x权限,但似乎有问题,代码未得到执行。

我的目的是在双击打开一个终端时执行一个批处理/ bash文件,并执行两个命令或更多命令。

Shebang以#!开头#! 不是!#

#!/bin/bash

# verbose mode ( or -v in shebang )
set -v

cd "/Users/Trans/Downloads/solr-6.1.0" && bin/solr start -p 8983
echo "press a key to continue"
read -n1

cd "/Users/Trans/Downloads/apache-activemq-5.12.0/bin" && ./activemq console
echo "press a key to continue"
read -n1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM