#!/bin/bash user=ExampleUser server=cloud.example.com account=$user@$server uri=davs://$account/remote.php/webdav uri_esc=$(echo $uri | sed s/\\//\\\\\\//g) online=$(gio mount -l | sed "/^Mount/! d;/$uri_esc/! d" | wc -l) echo $online if [ $online -gt 0 ]; then exit fi case $XDG_SESSION_TYPE in tty) gio mount $uri