view src/which.sh @ 26498:e36aefc588c2 v8.2.3779

patch 8.2.3779: using freed memory when defining a user command recursively Commit: https://github.com/vim/vim/commit/205f29c3e9b895dbaa4f738046da455a93c3812a Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 10 21:46:09 2021 +0000 patch 8.2.3779: using freed memory when defining a user command recursively Problem: Using freed memory when defining a user command from a user command. Solution: Do not use the command pointer after executing the command. (closes #9318)
author Bram Moolenaar <Bram@vim.org>
date Fri, 10 Dec 2021 23:00:04 +0100
parents 3fc0f57ecb91
children
line wrap: on
line source

#! /bin/sh
#
# which.sh -- find where an executable is located.  It's here because the
# "which" command is not supported everywhere.  Used by Makefile.

IFS=":"
for ac_dir in $PATH; do
	if test -f "$ac_dir/$1"; then
		echo "$ac_dir/$1"
		break
	fi
done