start-stop daemon

Jeroen Coumans jeroencoumans at gmx.net
Wed Apr 23 03:46:43 PDT 2003


Michael A. Peters wrote:
> On Tue, 2003-04-22 at 21:09, Michael A. Peters wrote:
> 
>>Yes, it does. A bash function could so so easily be written to do that -
>>but the binary will be faster. It is a very common binary for people to
>>want to have on their system anyway.
> 
> 
> Just for the record - I tried it with a shell function-
> scriptwhich()
> {
> 	binary=$1
> 	for a in `echo $PATH |sed -e s?":"?" "?g`; do
> 	if [ -x "$a/$binary" ]; then
> 		echo "$a/$binary"
> 		exit 0
> 	fi
> 	done
> 	exit 1
> }
> 
> It was considerably slower. Many times slower. On a XP 2700+
> I did fix the binary having to be in the path, though.
> If it's specified full path to the function it uses that.
> 

Try it with a proper function:
which () {
	unalias -a
	unset -- "$@" &> /dev/null
	enable -n -- "$@" &> /dev/null
	type -p "$@"
}

Assuming there's a #!/bin/bash on top. Else, use that as a seperate 
shell script.

-- 
Groeten/Greetings
Jeroen Coumans

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list