【发布时间】:2015-01-26 02:27:06
【问题描述】:
所以我想在调用 git 之前和之后运行一段 AppleScript(不是下面的 AppleScript,不同的 AppleScript,但这应该能说明问题)。我遇到的问题是 git 命令有可变数量的参数,所以我不能只使用 $1 给它第一个,它必须是传入的数字。这是我的代码在我的.bash_profile:
function git() {
osascript -e 'display alert "before git command"';
git "$@";
osascript -e 'display alert "after git command"';
}
预期的结果是第一段 applescript 运行,git 使用提供的任何数量的参数运行,然后运行最后一段 applescript。真正发生的是第一段 AppleScript 无限期地反复运行。我认为问题可能是 git 之后的"$@"。 From what I understand 使用 "$@" 将转储所有参数。但是第一段 applescript 只是在无限循环中运行。什么给了?
【问题讨论】:
-
上面的代码 sn-p 会发生这种情况吗?
-
@RespectMyAuthoritah 是的
标签: git bash shell applescript