Use $PWD instead of "$(pwd)". This fixes handling of paths which contain a linebreak in the end of their name - $() removes trailing linebreaks, see: http://mywiki.wooledge.org/BashPitfalls#content.3D.24.28.3Cfile.29
Further, of it is the cleaner solution to use existing shell varibles instead of calling subprocesses.