When you try to build, for instance in a markdown file, a link to a local file whose name contains lot of white spaces, some parsers will not allow these white spaces and thus the local links will not be operational.

The small script presented bellow show how to replace white spaces in a ‘string’ passed in argument with %20 character:

#!/bin/bash
echo $1|sed -e 's/ /%20/g'
  • That’s it! Enjoy!