Skip to content

Instantly share code, notes, and snippets.

@frontierpsycho
Last active February 14, 2021 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frontierpsycho/8bfe761514a59ba0048e717d35845bb6 to your computer and use it in GitHub Desktop.
Save frontierpsycho/8bfe761514a59ba0048e717d35845bb6 to your computer and use it in GitHub Desktop.
Disable some fortune databases
#!/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
@frontierpsycho
Copy link
Author

To be used with its companion gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment