Last active
February 14, 2021 10:20
-
-
Save frontierpsycho/8bfe761514a59ba0048e717d35845bb6 to your computer and use it in GitHub Desktop.
Disable some fortune databases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# replace with your least favourite fortune databases | |
COLLECTIONNAMES=('zippy' 'knghtbrd' 'misogyny' 'racism' 'misandry' 'hphobia') | |
FORTUNES_DIRECTORY=/usr/share/games/fortunes | |
OFFENSIVE_FORTUNES_DIRECTORY=${FORTUNES_DIRECTORY}/off | |
for collection in "${COLLECTIONNAMES[@]}"; do | |
echo "==================" | |
echo "Disabling ${collection}" | |
echo "Non offensive first..." | |
if [ -e "${FORTUNES_DIRECTORY}/${collection}.dat" ]; then | |
if sudo mv "${FORTUNES_DIRECTORY}/${collection}.dat" "${FORTUNES_DIRECTORY}/${collection}.dat.no"; then | |
echo "${collection} renamed." | |
else | |
echo "Failed to move ${collection}!" | |
exit 1 | |
fi | |
else | |
echo "${FORTUNES_DIRECTORY}/${collection}.dat does not exist, doing nothing" | |
fi | |
echo "Then offensive..." | |
if [ -e "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat" ]; then | |
if sudo mv "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat" "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat.no"; then | |
echo "${collection} renamed." | |
else | |
echo "Failed to move ${collection}!" | |
exit 1 | |
fi | |
else | |
echo "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat does not exist, doing nothing" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be used with its companion gist.