core-admin/appvm/wrap_in_html_if_url.sh
Rafal Wojtczuk 9fa0072215 qvm-open-in-*: recognize when the parameter is an url
and wrap it in html meta refresh tag, so that it will be opened by
the default browser.
2011-08-29 17:27:48 +02:00

17 lines
271 B
Bash

wrap_in_html_if_url()
{
case "$1" in
*://*)
FILE_ARGUMENT=$(mktemp)
echo -n '<html><meta HTTP-EQUIV="REFRESH" content="0; url=' > $FILE_ARGUMENT
echo -n "$1" >> $FILE_ARGUMENT
echo '"></html>' >> $FILE_ARGUMENT
;;
*)
FILE_ARGUMENT="$1"
;;
esac
}