You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
dotfiles/.bash_aliases

61 lines
1.6 KiB

_f_do_as() {
local file_name="$1"
shift # Remove the first argment (the file)
if [ -r "$file_name" ]; then
$@
else
$USE_SUPER $@
fi
}
toggle_protection() {
local choice
mkdir -p ~/.data
while true; do
echo "Do you want protection ON or OFF?"
echo "Protection will look for changes in the system, if found it will alert you. Its not perfect, but a smiple check."
echo "Note if truning on, please be an SUDOer or tell root what your doing! This is a global setting!"
echo "1) ON"
echo "2) OFF"
read -p "Enter your choice (1 or 2): " choice
case "$choice" in
1|on|ON|On|yes|y)
touch ~/.data/protectionON
echo "✓ Protection is now ON"
return 0
;;
2|off|OFF|Off|no|n)
touch ~/.data/protectionOFF
echo "✓ Protection is now OFF"
return 0
;;
*)
echo "✗ Invalid choice. Please enter 1 (ON) or 2 (OFF)"
echo ""
;;
esac
done
}
if [[ -f ~/scripts/helper/scan_aliases.sh && -f ~/.data/protectionON ]]; then
source ~/scripts/helper/scan_aliases.sh
else
if [ -f ~/.data/protectionOFF ]; then
SANE_TEST_FAILED=0
else
toggle_protection
SANE_TEST_FAILED=0
fi
fi
if [ $SANE_TEST_FAILED -eq 0 ]; then
# Load aliases from ~/.aliases.d
if [ -d ~/.aliases.d ]; then
for f in ~/.aliases.d/*.sh; do
[ -r "$f" ] && . "$f"
done
fi
fi