slitaz-base-files rev 277

libtaz.sh: fix again for empty values (--opt= is differ from --opt)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jun 18 21:52:33 2015 +0300 (2015-06-18)
parents cccd0d5e9cdf
children 5979e3b76e5e
files rootfs/lib/libtaz.sh
line diff
     1.1 --- a/rootfs/lib/libtaz.sh	Thu Jun 18 19:58:55 2015 +0300
     1.2 +++ b/rootfs/lib/libtaz.sh	Thu Jun 18 21:52:33 2015 +0300
     1.3 @@ -29,13 +29,16 @@
     1.4  # Parse cmdline options and store values in a variable.
     1.5  for opt in "$@"; do
     1.6  	case "$opt" in
     1.7 -		--*)
     1.8 +		--*=*)
     1.9  			opt_name="${opt%%=*}"; opt_name="$(echo -n "${opt_name#--}" | tr -c 'a-zA-Z0-9' '_')"
    1.10  			case "$opt_name" in
    1.11  				[0-9]*) opt_name="_$opt_name";;
    1.12  			esac
    1.13  			opt_value="${opt#--}="; opt_value="${opt_value#*=}"; opt_value="${opt_value%=}"
    1.14 -			export "$opt_name=${opt_value:-yes}"
    1.15 +			export "$opt_name=$opt_value"
    1.16 +			;;
    1.17 +		--*)
    1.18 +			export "${opt#--}=yes"
    1.19  			;;
    1.20  	esac
    1.21  done