Skip to content

Commit

Permalink
modify-sudoers.sh: Fixed a misplaced 'return' instruction by a more a…
Browse files Browse the repository at this point in the history
…ppropriate 'exit' instruction.

The 'return' instruction can be used only in a function.

Signed-off-by: Adrien Ricciardi <[email protected]>
  • Loading branch information
RICCIARDI-Adrien committed Apr 17, 2024
1 parent cc78940 commit fd98c22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modify-sudoers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ROOT_LINE_NUM=$(grep -n "^root" /etc/sudoers | cut -d : -f 1)
# Check if the root user is already configured to execute commands as other users
if sudo sed -n "${ROOT_LINE_NUM}p" /etc/sudoers | grep -q "ALL=(ALL:ALL)" ; then
echo "Root user is already configured to execute commands as other users."
return 0
exit 0
fi

echo "Attempting to safely modify /etc/sudoers..."
Expand All @@ -33,4 +33,4 @@ if [ $? -eq 0 ]; then
else
echo "Error while trying to modify /etc/sudoers, please edit manually."
exit 1
fi
fi

0 comments on commit fd98c22

Please sign in to comment.