#!/bin/bash
s='[the name of the link](www.example.com/a badly named thing)'
sed -e ':a' -e 's/\(\[[^][]*]([^()[:space:]]*\)[[:space:]]\{1,\}\([^()]*)\)/\1-\2/' -e 'ta' <<< "$s"