diff /etc/skel/.bashrc

This commit is contained in:
pvincent
2026-08-20 17:42:03 +04:00
parent 50f57e8fa1
commit 45f0c5690e
+4 -5
View File
@@ -43,16 +43,15 @@ function fix_users_bashrc {
local first_change
if first_change=$(diff /etc/skel/.bashrc "$user_bashrc" | head -n1); then
:
echo 'no change'
sudo -u "$user" -- cp "$MIAOU_BASH_DIR"/etc/skel/.bashrc "$user_bashrc"
else
if [[ $first_change =~ $appended_regex ]]; then
if new_lines=$(diff /etc/skel/.bashrc "$user_bashrc" | grep '^> ' | sed 's/^> //'); then
:
echo 'no new lines'
else
# echo -e "$new_lines"
sudo -u "$user" -- cp "$MIAOU_BASH_DIR"/etc/skel/.bashrc "$user_bashrc"
echo -e "$new_lines" | sudo -u $user -- tee -a "$user_bashrc"
echo -e "$new_lines" | sudo -u "$user" -- tee -a "$user_bashrc"
echo "INFO: .bashrc for user <$user> merged succesfully"
fi
else