#!/bin/bash # A script to handle custom protocol url="$1" file_path="${url#myfile://}" file_path=$(echo "$file_path" | sed 's/%20/ /g') file_path="${file_path/\~/$HOME}" xdg-open "$file_path"