Skip to content

Instantly share code, notes, and snippets.

@michaelskyba
Last active January 20, 2022 18:47
Show Gist options
  • Save michaelskyba/a00ebfa607cb72b9d6ba3bdc70b21088 to your computer and use it in GitHub Desktop.
Save michaelskyba/a00ebfa607cb72b9d6ba3bdc70b21088 to your computer and use it in GitHub Desktop.
#!/bin/sh
# a case statement works way better than the terrible xdg-open
# usage: msk_open <file>
# Get the raw filetype
type=$(file -i "$1")
# Parse file -i
type=${type#*: }
type=${type%;*}
# Pick the command
case "$type" in
#application/pdf) zathura "$1" ;;
*) echo "No configuration for type '$type'." ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment