Subject: Re: passing options through MAKEDEV to MAKEDEV.local
To: None <tech-userlevel@netbsd.org>
From: Eric Haszlakiewicz <erh@nimenees.com>
List: tech-userlevel
Date: 09/01/2006 02:42:11
On Thu, Aug 31, 2006 at 10:20:35PM -0500, David Young wrote:
> +opts=
>  do_force=false
>  do_specfile=false
>  while getopts fm:s ch; do
> @@ -346,6 +347,12 @@ while getopts fm:s ch; do
>  	*)	usage ;;
>  	esac
>  done
> +i=1
> +for opt; do
> +	[ $i -gt $((${OPTIND} - 1)) ] && break
> +	opts="$opts $opt"
depending how picky you want to be, you might rewrite this as:

opt=$(echo "$opt" | sed -e's/\\/\\\\/' -e's/"/\\"/')
opts="$opts \"$opt\""

> +	i=$(($i + 1))
> +done
>  shift $((${OPTIND} - 1))
>  [ $# -gt 0 ] || usage
>  
> @@ -1603,7 +1614,7 @@ midevend)
>  local)
>  	if [ -f "$0.local" ]; then
>  		umask 0
> -		sh $0.local all
> +		sh $0.local $opts all
and:
		eval sh '$0.local' "$opts" all

Which will allow you to pass along args with spaces, quotes and backslashes.
It's probably overkill for the MAKEDEV script.

eric