[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: command -v in postinsts violating policy



On Sun, May 26, 2002 at 10:36:20PM -0500, Branden Robinson wrote:
> Ideally, I want:
> 
> 1) a command that searches $PATH for an executable of the given name,
> ignoring aliases and shell functions
> 2) a command that with a flag can be told not to spew any output under
> any circumstances (a la grep -qs)
> 3) a command that doesn't demand that we declare dependencies or
> pre-dependencies on a package just so we can use it our maintainer
> scripts

Taking a slight liberty with #2, would something along these lines suffice?

spath () {
	IFS=':'
	for DIR in $PATH ; do
		test -x $DIR/$1 && echo $DIR/$1 && unset IFS && return
	done
	unset IFS
	false
}

spath_quiet () {
	IFS=':'
	for DIR in $PATH ; do
		test -x $DIR/$1 && unset IFS && return
	done
	unset IFS
	false
}

Disclaimer: I must be nuts.

Mark.


-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: