Last active
March 28, 2022 20:51
-
-
Save Bigjango13/b2ca994f557e61ca381277f9227777c8 to your computer and use it in GitHub Desktop.
A small function to see what programs can open a file.
This file contains hidden or 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
canopener (){ | |
if [[ $1 == "" ]]; then | |
echo "You need to specify a file." | |
else | |
grep "`xdg-mime query filetype $1`" -R /usr/share/applications/* --files-with-matches --color=never | grep -v mimeinfo.cache | xargs grep "^Exec=" --no-filename | awk -F'=' '{print $2}' | awk -F' ' '{print $1}' | sort | uniq | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment