From d591b5f2be9b65264ee500fc8af56e17b5675d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Tue, 19 Jun 2012 10:29:20 +0200 Subject: [PATCH] Do not use global variable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/type/__user/gencode-remote | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index bbf373d4..5a868b67 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -28,16 +28,17 @@ name="$__object_id" # systems (such as *BSD, Darwin) those commands do not handle GNU style long # options. shorten_property() { - RET= - case "$1" in - comment) RET="-c";; - home) RET="-d";; - gid) RET="-g";; - groups) RET="-G";; - password) RET="-p";; - shell) RET="-s";; - uid) RET="-u";; - esac + local ret="" + case "$1" in + comment) ret="-c";; + home) ret="-d";; + gid) ret="-g";; + groups) ret="-G";; + password) ret="-p";; + shell) ret="-s";; + uid) ret="-u";; + esac + echo "$ret" } cd "$__object/parameter" @@ -83,8 +84,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then fi if [ "$new_value" != "$current_value" ]; then - shorten_property $property - set -- "$@" "$RET" \'$new_value\' + local option=$(shorten_property $property) + set -- "$@" "$option" \'$new_value\' fi done @@ -96,8 +97,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - shorten_property $property - set -- "$@" "$RET" \'$new_value\' + local option=$(shorten_property $property) + set -- "$@" "$option" \'$new_value\' done echo useradd "$@" "$name"