diff /etc/skel/.bashrc
This commit is contained in:
+4
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user