1

I have a personal scripts folder: ~/google_drive/code/scripts. This folder is on my $path. $path is set in ~/.zshenv and not changed anywhere else (I've disabled OS X path_helper and I don't touch $path in any other zsh startup file). In this scripts folder, there is a subdirectory called alfred_workflows. From the command line, from any location I am able to run scripts in this folder with relative paths. This is expected:

$ alfred_workflows/test.sh
#=> test successful

But in a script, this does not work. It generates an error:

$ zsh -c "alfred_workflows/test.sh"
#=> zsh:1: no such file or directory: alfred_workflows/test.sh

Once again, the scripts directory that contains alfred_workflows is on $path, which is set in ~/.zshenv, and I am able to run executables that reside in the top level of this directory from a script. The issue only seems to be when I try to go through a subdirectory. What might be the problem?

4

1 に答える 1

4

path_dirsオプションが設定されている場合、の検索$pathはスラッシュを含む名前に対してのみ実行 されます。どうやらそれはインタラクティブシェルで設定されていますが、スクリプトを実行しているプロセスでは設定されていません。

于 2013-03-19T02:05:28.590 に答える