Are you sure it's bash? The backtick operator is not portable. There are several ways to (possibly) fix this:
- use
#!/bin/bash
in the first line to make dure it's bash not anything else - avoid the backticks:
currentdir=$(pwd)
orcurrentdir=$(/bin/pwd)
- or even simpler
currentdir=$PWD