Replace spaces in this shell script with %20
You can pipe to sed 's/ /%20/g' to replace spaces with %20.

toTheClipboard="File Path: file://$(echo $1 | sed 's/ /%20/g') Parent Folder: file://$(dirname "$1" | sed 's/ /%20/g')" pbcopy&lt;&lt;&lt;"$toTheClipboard"