Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Check existence of a program



On Feb 1, 11:59pm, Anonymous bin Ich wrote:
}
} % cat notworking.zsh
} #!/bin/zsh
} set -x
} prog="exiftime"
} path=$(which ${prog})

As has already been pointed out, assigning to $path alters the value of
$PATH, which makes it impossible to find any other executables.

One way to prevent yourself from getting into trouble with this:

    readonly path

Now you can still assign to PATH (and the new value is reflected in
the $path array), but you can't accidentally stomp on it via direct
assignment to path.



Messages sorted by: Reverse Date, Date, Thread, Author