From b1fcb904eab1425d349fd7ab8d65b39c1bfb2e3f Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Wed, 24 Oct 2007 09:08:12 -0700 Subject: fix sed command ordering --- scripts/system/vyatta_update_login_user.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/system/vyatta_update_login_user.pl b/scripts/system/vyatta_update_login_user.pl index f51b8001..d3e51593 100755 --- a/scripts/system/vyatta_update_login_user.pl +++ b/scripts/system/vyatta_update_login_user.pl @@ -81,7 +81,6 @@ sub remove_user_from_group { # adds the specified user to group/gshadow sub add_user_to_group { my $user = shift; - my $gcmd = 'grep -q -e \'^' . $DEF_GROUP . ':.*[:,]' . $user . '\(,\|$\)\''; my $ret = system("$gcmd /etc/group"); my $in_group = (($ret >> 8) == 0) ? 1 : 0; @@ -89,8 +88,8 @@ sub add_user_to_group { my $in_gshadow = (($ret >> 8) == 0) ? 1 : 0; my $sed_cmd = 'sed -i \'/^' . $DEF_GROUP . ':/{' - . 's/:$/:' . $user . '/;' - . 's/\([^:]\)$/\1,' . $user . '/;}\''; + . 's/\([^:]\)$/\1,' . $user . '/;' + . 's/:$/:' . $user . '/;}\''; if (!$in_group) { system("$sed_cmd /etc/group"); exit 1 if ($? >> 8); -- cgit v1.2.3