Files
bashrc/lock_unlock_bashrc.sh
2025-08-15 16:25:03 +00:00

64 lines
1.1 KiB
Bash

source /root/logger.sh
log_start
log_info "Starte Lock/Unlock Bashrc"
ende=nein
while [ $ende = "nein" ]; do
echo
echo
echo "1 = LOCK"
echo " "
echo "2 = UNLOCK und Editieren"
echo "22= UNLOCK und Ende"
echo " "
echo "3 = .bashrc neu einlesen"
echo " "
echo "0 = Ende"
echo
read -p "Deine Wahl: 1/2/3/0 " wwahl
if [ $wwahl = 1 ]
then
sudo chattr +i .bashrc
log_info "Gesichert! $?"
fi
if [ $wwahl = 2 ]
then
sudo chattr -i .bashrc
log_info "Geöffnet! $?"
log_info "öffne Datei..."
nano .bashrc
log_info "Datei geschlossen $?"
sudo chattr +i .bashrc
log_info "Gesichert $?"
source /home/oberkoetter/.bashrc
echo "Änderungen sind nach dem Neustart der"
echo "Konsole wirksam"
fi
if [ $wwahl = 22 ]
then
sudo chattr -i .bashrc
log_info "Geöffnet! $?"
exit 0
fi
if [ $wwahl = "3" ]
then
log_info "Lese neu…"
. .bashrc
log_info "Err: $?"
fi
if [ $wwahl = "0" ]
then
ende="ja"
fi
done
log_end