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

Bug#218530: Specify bash in template?



> If "type -p" is the one and only appropriate way to test for the
> runability of a command before running it then the only solution I
> can think of is to change the example to this:

Well, since it's not, we don't have to worry about it.

> 	#!/bin/bash
> 	# A shell is required that implements the "type" command
> 	...
> 	if type invoke-rc.d >/dev/null 2>&1 ; then
> 		invoke-rc.d package <action>
> 	else
> 		/etc/init.d/package <action>
> 	fi

If you really want to check for shell aliases and functions,
you could do this instead.

#!/bin/sh

err=0

invoke-rc.d package <action> || err=$?
case "$err" in
	(12[67])
	/etc/init.d/package <action>
	;;
	(*)
	exit $err
	;;
esac


As a third option, you could change Debian policy to require conformance
with "SUSv3 + echo -n + command -v".



Reply to: