Skip to content

Commit

Permalink
use xargs in correct_value.pass.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcanonical committed Jan 10, 2025
1 parent d395845 commit 42f838c
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
# remediation = none

{{% if 'ubuntu' in product %}}
users_to_remove=$(awk -F: '$4 == 0 && $1 !~ /^(root|sync|shutdown|halt|operator)$/ {print $1}' /etc/passwd)
for user in $users_to_remove; do
sudo userdel -rf "$user"
done
awk -F: '$4 == 0 && $1 !~ /^(root|sync|shutdown|halt|operator)$/ {print $1}' /etc/passwd | xargs --no-run-if-empty -I '{}' userdel -f '{}'
{{% endif %}}

0 comments on commit 42f838c

Please sign in to comment.