Skip to content
Snippets Groups Projects
Commit c61a70e8 authored by Thiago Abdo's avatar Thiago Abdo
Browse files

[add user] using only local vars in functions


Signed-off-by: default avatarThiago Abdo <tja14@inf.ufpr.br>
parent 51c95256
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment