How to return from xdg-open within a shell script

Solution 1:

xdg-open detaches the command it runs from the terminal, so probably your terminal is freed. Only, you see some output of the browser rather than the command prompt. Just hit Ctrl+L or give the command clear to return to a neat terminal prompt.

You could, for aestetic reasons, redirect terminal output to /dev/null by adding 1>/dev/null 2>&1 after the command. Alternatively, prepend the command with nohup will also work. This immediately detaches the xdgopen command from the terminal and redirects its output.