zsh:权限被拒绝:gam

时间:2018-06-28 00:10:01

标签: macos shell zsh oh-my-zsh

我在安装了Oh My ZSH的macOS 10.12上使用ZSH。

我最近使用提供的安装脚本//Create data and serialise to JSON var data = new { message = "hello world" }; string dataAsJson = JsonConvert.SerializeObject(data); //Create request with data HttpConfiguration config = new HttpConfiguration(); HttpRequestMessage request = new HttpRequestMessage(); request.SetConfiguration(config); request.Method = HttpMethod.Post; request.Content = new StringContent(dataAsJson, Encoding.UTF8, "application/json"); string requestContentT = request.Content.ReadAsAsync<string>().Result; // -> JsonReaderException: Error reading string.Unexpected token: StartObject.Path '', line 1, position 1. string requestContentS = request.Content.ReadAsStringAsync().Result; // -> "{\"message\":\"hello world\"}" //Create response from request with same data HttpResponseMessage responseFromRequest = request.CreateResponse(HttpStatusCode.OK, dataAsJson, "application/json"); string responseFromRequestContentT = responseFromRequest.Content.ReadAsAsync<string>().Result; // -> "{\"message\":\"hello world\"}" string responseFromRequestContentS = responseFromRequest.Content.ReadAsStringAsync().Result; // -> "\"{\\\"message\\\":\\\"hello world\\\"}\"" //Create a standalone new response HttpResponseMessage responseNew = new HttpResponseMessage(); responseNew.Content = new StringContent(dataAsJson, Encoding.UTF8, "application/json"); string responseNewContentT = responseNew.Content.ReadAsAsync<string>().Result; // -> JsonReaderException: Error reading string.Unexpected token: StartObject.Path '', line 1, position 1. string responseNewContentS = responseNew.Content.ReadAsStringAsync().Result; // -> "{\"message\":\"hello world\"}" 在计算机上安装了GAM

该脚本将命令行工具bash <(curl -s -S -L https://git.io/install-gam)安装到gam中的~/bin/gam/gam中。

但是,当尝试在ZSH中执行任何PATH命令时,我得到以下信息:

gam

但是,当在bash中执行相同(或任何)命令时,该工具将按预期工作。

我已经可以通过将➜ ~ gam info user zsh: permission denied: gam 放入我的alias gam="~/bin/gam/gam"来使命令正常工作,但这会导致以.zshrc开头的gam参数出现一些意外的问题。

~拥有执行权限及其附带的文件夹~/bin/gam/gam,因此我无法弄清楚这里出了什么问题。

1 个答案:

答案 0 :(得分:2)

tl; dr进行评论:

~/bin/在我的PATH中,但子文件夹~/bin/gam/在我的gam中。调用~/bin/gam/会使ZSH找到文件夹permission denied并尝试执行它,因此出现command not found错误而不是gam

~/bin/gam/在BASH中工作的原因是,安装脚本仅将PATH添加到了.bashrc中的.zshrc中,而不是None