From c61a70e86b6123d695747f5807e48524352193a8 Mon Sep 17 00:00:00 2001 From: Thiago Abdo <tja14@inf.ufpr.br> Date: Tue, 19 Jan 2016 09:17:17 -0200 Subject: [PATCH] [add user] using only local vars in functions Signed-off-by: Thiago Abdo <tja14@inf.ufpr.br> --- hdd/adduser.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hdd/adduser.sh b/hdd/adduser.sh index 4b103c3..e77c00e 100755 --- a/hdd/adduser.sh +++ b/hdd/adduser.sh @@ -112,13 +112,12 @@ remove_group(){ } remove_user(){ - - userDetail=$1 - userName=$( echo $userDetail | cut -d':' -f1 ); + local userDetail=$1 + local userName=$( echo $userDetail | cut -d':' -f1 ); echo $0": Removendo usuário "$userName" do passwd e shadow" #remove from passwd - temp=mktemp; + local temp=$(mktemp) sed "/^$userDetail:/d" /etc/passwd > $temp cp $temp /etc/passwd chown root:root /etc/passwd @@ -126,7 +125,7 @@ remove_user(){ rm $temp #remove from shadow - temp=mktemp; + local temp=$(mktemp) sed "/^$userName:/d" /etc/shadow > $temp cp $temp /etc/shadow chown root:shadow /etc/shadow -- GitLab