[GRASS-dev] Re: [GRASS GIS] #81: scripts: "echo -n" not portable

Glynn Clements glynn at gclements.plus.com
Wed Mar 12 00:21:15 EDT 2008


GRASS GIS wrote:

>  -    echo -n 'eval '
>  -    echo -n "$3"                    # Destination name
>  -    echo -n '=${'
>  -    echo -n "$1"                    # Source name
>  -    echo -n "[$2]}"
>  +    echo "eval $3=${$1[$2]}"

>  ?will that work?

I wouldn't count on it; the shell may attempt to evaluate the ${...}
part.

I suspect that may be why it was output in pieces in the first place.

Try:
	echo 'eval '"$3"'=${'"$1""[$2]}"

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list