#!/bin/bash # make sure to only remove symlinks and unneeded dicts keep_dicts=('de_DE' 'fr_FR' 'en_US' 'en_GB') dicts="$(ls /usr/share/hunspell/* /usr/share/myspell/dicts/*)" for keep_dict in ${keep_dicts[@]}; do dicts=$(echo $dicts | sed "s/\S*${keep_dict}\S* //g") done sudo rm ${dicts[@]}